0s autopkgtest [10:25:28]: starting date and time: 2025-11-17 10:25:28+0000 0s autopkgtest [10:25:28]: git checkout: 508d4a25 a-v-ssh wait_for_ssh: demote "ssh connection failed" to a debug message 0s autopkgtest [10:25:28]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.h18ea35h/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_proxy=127.0.0.1,127.0.1.1,localhost,localdomain,internal,login.ubuntu.com,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com\n" >> /etc/environment' --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' -- lxd -r lxd-armhf-10.145.243.85 lxd-armhf-10.145.243.85:autopkgtest/ubuntu/resolute/armhf 22s autopkgtest [10:25:50]: testbed dpkg architecture: armhf 24s autopkgtest [10:25:52]: testbed apt version: 3.1.11 27s autopkgtest [10:25:55]: @@@@@@@@@@@@@@@@@@@@ test bed setup 29s autopkgtest [10:25:57]: testbed release detected to be: None 37s autopkgtest [10:26:05]: updating testbed package index (apt update) 39s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [87.8 kB] 39s Get:2 http://ftpmaster.internal/ubuntu resolute InRelease [87.8 kB] 39s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 39s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 39s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [80.3 kB] 39s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [881 kB] 39s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [22.9 kB] 39s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/restricted Sources [9848 B] 39s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf Packages [138 kB] 39s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/restricted armhf Packages [940 B] 39s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/universe armhf Packages [541 kB] 39s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse armhf Packages [9684 B] 39s Get:13 http://ftpmaster.internal/ubuntu resolute/main Sources [1416 kB] 39s Get:14 http://ftpmaster.internal/ubuntu resolute/universe Sources [21.3 MB] 40s Get:15 http://ftpmaster.internal/ubuntu resolute/main armhf Packages [1369 kB] 40s Get:16 http://ftpmaster.internal/ubuntu resolute/universe armhf Packages [15.0 MB] 44s Fetched 40.9 MB in 5s (7809 kB/s) 45s Reading package lists... 51s autopkgtest [10:26:19]: upgrading testbed (apt dist-upgrade and autopurge) 53s Reading package lists... 53s Building dependency tree... 53s Reading state information... 54s Calculating upgrade... 54s The following packages will be upgraded: 54s libpython3-stdlib python3 python3-minimal usbutils 55s 4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 55s Need to get 140 kB of archives. 55s After this operation, 0 B of additional disk space will be used. 55s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf python3-minimal armhf 3.13.7-2 [27.8 kB] 55s Get:2 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf python3 armhf 3.13.7-2 [23.9 kB] 55s Get:3 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf libpython3-stdlib armhf 3.13.7-2 [10.6 kB] 55s Get:4 http://ftpmaster.internal/ubuntu resolute/main armhf usbutils armhf 1:019-1 [77.7 kB] 56s Fetched 140 kB in 0s (343 kB/s) 56s (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 ... 65904 files and directories currently installed.) 56s Preparing to unpack .../python3-minimal_3.13.7-2_armhf.deb ... 56s Unpacking python3-minimal (3.13.7-2) over (3.13.7-1) ... 56s Setting up python3-minimal (3.13.7-2) ... 56s (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 ... 65904 files and directories currently installed.) 56s Preparing to unpack .../python3_3.13.7-2_armhf.deb ... 56s Unpacking python3 (3.13.7-2) over (3.13.7-1) ... 56s Preparing to unpack .../libpython3-stdlib_3.13.7-2_armhf.deb ... 56s Unpacking libpython3-stdlib:armhf (3.13.7-2) over (3.13.7-1) ... 56s Preparing to unpack .../usbutils_1%3a019-1_armhf.deb ... 56s Unpacking usbutils (1:019-1) over (1:018-2) ... 56s Setting up usbutils (1:019-1) ... 56s Setting up libpython3-stdlib:armhf (3.13.7-2) ... 56s Setting up python3 (3.13.7-2) ... 56s Processing triggers for man-db (2.13.1-1) ... 59s Reading package lists... 60s Building dependency tree... 60s Reading state information... 60s Solving dependencies... 61s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 62s autopkgtest [10:26:30]: rebooting testbed after setup commands that affected boot 103s autopkgtest [10:27:11]: testbed running kernel: Linux 6.8.0-86-generic #87~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 29 09:26:46 UTC 2 127s autopkgtest [10:27:35]: @@@@@@@@@@@@@@@@@@@@ apt-source python-xarray 141s Get:1 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (dsc) [3963 B] 141s Get:2 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (tar) [2781 kB] 141s Get:3 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (diff) [20.6 kB] 142s gpgv: Signature made Mon May 5 11:14:20 2025 UTC 142s gpgv: using RSA key 7E1AC3FA27A649284C323EF6695C429316C07BFE 142s gpgv: issuer "jdg@debian.org" 142s gpgv: Can't check signature: No public key 142s dpkg-source: warning: cannot verify inline signature for ./python-xarray_2025.03.1-8.dsc: no acceptable signature found 142s autopkgtest [10:27:50]: testing package python-xarray version 2025.03.1-8 144s autopkgtest [10:27:52]: build not needed 147s autopkgtest [10:27:55]: test pybuild-autopkgtest: preparing testbed 149s Reading package lists... 149s Building dependency tree... 149s Reading state information... 149s Solving dependencies... 150s The following NEW packages will be installed: 150s autoconf automake autopoint autotools-dev blt build-essential cpp cpp-15 150s cpp-15-arm-linux-gnueabihf cpp-arm-linux-gnueabihf debhelper debugedit 150s dh-autoreconf dh-python dh-strip-nondeterminism docutils-common dwz 150s fontconfig-config fonts-dejavu-core fonts-dejavu-mono fonts-font-awesome 150s fonts-lato fonts-lyx fonts-mathjax fonts-open-sans g++ g++-15 150s g++-15-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc gcc-15 150s gcc-15-arm-linux-gnueabihf gcc-arm-linux-gnueabihf gdb gettext 150s intltool-debian ipython3 libaec0 libarchive-zip-perl libasan8 libbabeltrace1 150s libblas3 libblosc1 libc-dev-bin libc6-dbg libc6-dev libcares2 libcc1-0 150s libcrypt-dev libdebhelper-perl libdebuginfod-common libdebuginfod1t64 150s libdeflate0 libdw1t64 libfile-stripnondeterminism-perl libfontconfig1 150s libfreetype6 libgcc-15-dev libgeos-c1t64 libgeos3.13.1 libgfortran5 libgomp1 150s libgraphite2-3 libharfbuzz0b libhdf5-310 libhdf5-hl-310 libimagequant0 150s libisl23 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-mathjax 150s libjs-requirejs libjs-sphinxdoc libjs-sprintf-js libjs-underscore 150s libjson-perl liblapack3 liblcms2-2 liblerc4 liblua5.4-0 liblzf1 libmpc3 150s libnetcdf22 libnode115 libnorm1t64 libopenjp2-7 libpgm-5.3-0t64 libproj25 150s libpython3.13 libpython3.14-minimal libpython3.14-stdlib libqhull-r8.0 150s libraqm0 libsharpyuv0 libsnappy1v5 libsodium23 libsource-highlight-common 150s libsource-highlight4t64 libstdc++-15-dev libsz2 libtcl8.6 libtiff6 libtk8.6 150s libtool libubsan1 libwebp7 libwebpdemux2 libwebpmux3 libxft2 libxrender1 150s libxslt1.1 libxss1 libzmq5 libzopfli1 linux-libc-dev m4 mypy node-acorn 150s node-argparse node-balanced-match node-brace-expansion node-cjs-module-lexer 150s node-corepack node-debug node-esprima node-fortawesome-fontawesome-free 150s node-js-yaml node-llhttp node-lru-cache node-minimatch node-ms node-semver 150s node-sprintf-js node-undici node-xtend nodejs pandoc pandoc-data po-debconf 150s proj-data pybuild-plugin-autopkgtest pybuild-plugin-pyproject 150s python-cartopy-data python-dask-doc python-hypothesis-doc 150s python-matplotlib-data python-pandas-doc python-scipy-doc 150s python-tinycss2-common python-xarray-doc python3-accessible-pygments 150s python3-alabaster python3-all python3-asttokens python3-autodocsumm 150s python3-bleach python3-bottleneck python3-brotli python3-bs4 python3-build 150s python3-cartopy python3-cftime python3-click python3-cloudpickle 150s python3-comm python3-contourpy python3-coverage python3-crc32c 150s python3-cycler python3-dask python3-debugpy python3-decorator 150s python3-defusedxml python3-doc python3-docutils python3-donfig 150s python3-execnet python3-executing python3-fastjsonschema python3-flexcache 150s python3-flexparser python3-fonttools python3-fs python3-fsspec 150s python3-h5netcdf python3-h5py python3-h5py-serial python3-html5lib 150s python3-hypothesis python3-imagesize python3-iniconfig python3-installer 150s python3-ipykernel python3-ipython python3-jedi python3-jupyter-client 150s python3-jupyter-console python3-jupyter-core python3-jupyterlab-pygments 150s python3-kiwisolver python3-locket python3-lxml python3-lz4 150s python3-matplotlib python3-matplotlib-inline python3-mistune python3-mpmath 150s python3-mypy python3-mypy-extensions python3-nbclient python3-nbconvert 150s python3-nbformat python3-nbsphinx python3-nest-asyncio python3-netcdf4 150s python3-numcodecs python3-numpy python3-numpy-dev python3-numpydoc 150s python3-pandas python3-pandas-lib python3-pandocfilters python3-parso 150s python3-partd python3-pickleshare python3-pil python3-pil.imagetk 150s python3-pint python3-pip python3-platformdirs python3-pluggy python3-pooch 150s python3-prompt-toolkit python3-psutil python3-pure-eval 150s python3-pydata-sphinx-theme python3-pyproj python3-pyproject-hooks 150s python3-pyshp python3-pytest python3-pytest-mypy python3-pytest-xdist 150s python3-pytz python3-regex python3-roman python3-scipy python3-seaborn 150s python3-setuptools-scm python3-shapely python3-snowballstemmer 150s python3-sortedcontainers python3-soupsieve python3-sphinx 150s python3-sphinx-book-theme python3-sphinx-copybutton python3-sphinx-design 150s python3-sphinx-gallery python3-sphinx-inline-tabs 150s python3-sphinx-remove-toctrees python3-sphinx-rtd-theme 150s python3-sphinxcontrib-mermaid python3-sphinxcontrib.jquery 150s python3-sphinxext-opengraph python3-sphinxext-rediraffe python3-stack-data 150s python3-sympy python3-tinycss2 python3-tk python3-tomlkit python3-toolz 150s python3-tornado python3-traitlets python3-typeshed python3-ufolib2 150s python3-wcwidth python3-webencodings python3-wheel python3-xarray 150s python3-zarr python3-zmq python3-zopfli python3.13-doc python3.13-tk 150s python3.14 python3.14-minimal python3.14-tk rpcsvc-proto sgml-base 150s sphinx-common sphinx-rtd-theme-common tk8.6-blt2.5 tzdata-legacy 150s unicode-data x11-common xml-core 150s 0 upgraded, 297 newly installed, 0 to remove and 0 not upgraded. 150s Need to get 329 MB of archives. 150s After this operation, 1585 MB of additional disk space will be used. 150s Get:1 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-lato all 2.015-1 [2781 kB] 151s Get:2 http://ftpmaster.internal/ubuntu resolute/main armhf libdebuginfod-common all 0.194-1 [15.1 kB] 151s Get:3 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf python3-numpy-dev armhf 1:2.3.4+ds-3ubuntu1 [140 kB] 151s Get:4 http://ftpmaster.internal/ubuntu resolute/main armhf libblas3 armhf 3.12.1-7 [133 kB] 151s Get:5 http://ftpmaster.internal/ubuntu resolute/main armhf libgfortran5 armhf 15.2.0-7ubuntu1 [334 kB] 151s Get:6 http://ftpmaster.internal/ubuntu resolute/main armhf liblapack3 armhf 3.12.1-7 [2091 kB] 151s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf python3-numpy armhf 1:2.3.4+ds-3ubuntu1 [4726 kB] 151s Get:8 http://ftpmaster.internal/ubuntu resolute/main armhf libpython3.14-minimal armhf 3.14.0-4 [892 kB] 151s Get:9 http://ftpmaster.internal/ubuntu resolute/main armhf python3.14-minimal armhf 3.14.0-4 [2146 kB] 151s Get:10 http://ftpmaster.internal/ubuntu resolute/main armhf m4 armhf 1.4.20-2 [212 kB] 151s Get:11 http://ftpmaster.internal/ubuntu resolute/main armhf autoconf all 2.72-3.1ubuntu1 [384 kB] 151s Get:12 http://ftpmaster.internal/ubuntu resolute/main armhf autotools-dev all 20240727.1 [43.4 kB] 151s Get:13 http://ftpmaster.internal/ubuntu resolute/main armhf automake all 1:1.18.1-2 [581 kB] 151s Get:14 http://ftpmaster.internal/ubuntu resolute/main armhf autopoint all 0.23.2-1 [620 kB] 151s Get:15 http://ftpmaster.internal/ubuntu resolute/main armhf libtcl8.6 armhf 8.6.17+dfsg-1 [918 kB] 151s Get:16 http://ftpmaster.internal/ubuntu resolute/main armhf libfreetype6 armhf 2.13.3+dfsg-1build1 [334 kB] 151s Get:17 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-dejavu-mono all 2.37-8 [502 kB] 151s Get:18 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-dejavu-core all 2.37-8 [835 kB] 151s Get:19 http://ftpmaster.internal/ubuntu resolute/main armhf fontconfig-config armhf 2.15.0-2.3ubuntu1 [38.1 kB] 151s Get:20 http://ftpmaster.internal/ubuntu resolute/main armhf libfontconfig1 armhf 2.15.0-2.3ubuntu1 [114 kB] 151s Get:21 http://ftpmaster.internal/ubuntu resolute/main armhf libxrender1 armhf 1:0.9.12-1 [16.6 kB] 151s Get:22 http://ftpmaster.internal/ubuntu resolute/main armhf libxft2 armhf 2.3.6-1build1 [37.4 kB] 152s Get:23 http://ftpmaster.internal/ubuntu resolute/main armhf x11-common all 1:7.7+24ubuntu1 [22.4 kB] 152s Get:24 http://ftpmaster.internal/ubuntu resolute/main armhf libxss1 armhf 1:1.2.3-1build3 [6500 B] 152s Get:25 http://ftpmaster.internal/ubuntu resolute/main armhf libtk8.6 armhf 8.6.17-1 [694 kB] 152s Get:26 http://ftpmaster.internal/ubuntu resolute/main armhf tk8.6-blt2.5 armhf 2.5.3+dfsg-8 [527 kB] 152s Get:27 http://ftpmaster.internal/ubuntu resolute/main armhf blt armhf 2.5.3+dfsg-8 [4824 B] 152s Get:28 http://ftpmaster.internal/ubuntu resolute/main armhf libc-dev-bin armhf 2.42-2ubuntu2 [21.8 kB] 152s Get:29 http://ftpmaster.internal/ubuntu resolute/main armhf linux-libc-dev armhf 6.17.0-5.5 [1771 kB] 152s Get:30 http://ftpmaster.internal/ubuntu resolute/main armhf libcrypt-dev armhf 1:4.4.38-1build1 [120 kB] 152s Get:31 http://ftpmaster.internal/ubuntu resolute/main armhf rpcsvc-proto armhf 1.4.3-1 [62.3 kB] 152s Get:32 http://ftpmaster.internal/ubuntu resolute/main armhf libc6-dev armhf 2.42-2ubuntu2 [1416 kB] 152s Get:33 http://ftpmaster.internal/ubuntu resolute/main armhf libisl23 armhf 0.27-1 [546 kB] 152s Get:34 http://ftpmaster.internal/ubuntu resolute/main armhf libmpc3 armhf 1.3.1-2 [47.0 kB] 152s Get:35 http://ftpmaster.internal/ubuntu resolute/main armhf cpp-15-arm-linux-gnueabihf armhf 15.2.0-7ubuntu1 [10.1 MB] 152s Get:36 http://ftpmaster.internal/ubuntu resolute/main armhf cpp-15 armhf 15.2.0-7ubuntu1 [1030 B] 152s Get:37 http://ftpmaster.internal/ubuntu resolute/main armhf cpp-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [5756 B] 152s Get:38 http://ftpmaster.internal/ubuntu resolute/main armhf cpp armhf 4:15.2.0-4ubuntu1 [22.4 kB] 152s Get:39 http://ftpmaster.internal/ubuntu resolute/main armhf libcc1-0 armhf 15.2.0-7ubuntu1 [43.5 kB] 152s Get:40 http://ftpmaster.internal/ubuntu resolute/main armhf libgomp1 armhf 15.2.0-7ubuntu1 [129 kB] 152s Get:41 http://ftpmaster.internal/ubuntu resolute/main armhf libasan8 armhf 15.2.0-7ubuntu1 [2950 kB] 153s Get:42 http://ftpmaster.internal/ubuntu resolute/main armhf libubsan1 armhf 15.2.0-7ubuntu1 [1187 kB] 153s Get:43 http://ftpmaster.internal/ubuntu resolute/main armhf libgcc-15-dev armhf 15.2.0-7ubuntu1 [898 kB] 153s Get:44 http://ftpmaster.internal/ubuntu resolute/main armhf gcc-15-arm-linux-gnueabihf armhf 15.2.0-7ubuntu1 [19.5 MB] 154s Get:45 http://ftpmaster.internal/ubuntu resolute/main armhf gcc-15 armhf 15.2.0-7ubuntu1 [493 kB] 154s Get:46 http://ftpmaster.internal/ubuntu resolute/main armhf gcc-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [1220 B] 154s Get:47 http://ftpmaster.internal/ubuntu resolute/main armhf gcc armhf 4:15.2.0-4ubuntu1 [5022 B] 154s Get:48 http://ftpmaster.internal/ubuntu resolute/main armhf libstdc++-15-dev armhf 15.2.0-7ubuntu1 [2637 kB] 154s Get:49 http://ftpmaster.internal/ubuntu resolute/main armhf g++-15-arm-linux-gnueabihf armhf 15.2.0-7ubuntu1 [11.4 MB] 155s Get:50 http://ftpmaster.internal/ubuntu resolute/main armhf g++-15 armhf 15.2.0-7ubuntu1 [23.7 kB] 155s Get:51 http://ftpmaster.internal/ubuntu resolute/main armhf g++-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [968 B] 155s Get:52 http://ftpmaster.internal/ubuntu resolute/main armhf g++ armhf 4:15.2.0-4ubuntu1 [1086 B] 155s Get:53 http://ftpmaster.internal/ubuntu resolute/main armhf build-essential armhf 12.12ubuntu1 [5088 B] 155s Get:54 http://ftpmaster.internal/ubuntu resolute/main armhf libdebhelper-perl all 13.24.2ubuntu1 [95.7 kB] 155s Get:55 http://ftpmaster.internal/ubuntu resolute/main armhf libtool all 2.5.4-7 [169 kB] 155s Get:56 http://ftpmaster.internal/ubuntu resolute/main armhf dh-autoreconf all 21 [12.5 kB] 155s Get:57 http://ftpmaster.internal/ubuntu resolute/main armhf libarchive-zip-perl all 1.68-1 [90.2 kB] 155s Get:58 http://ftpmaster.internal/ubuntu resolute/main armhf libfile-stripnondeterminism-perl all 1.15.0-1 [20.5 kB] 155s Get:59 http://ftpmaster.internal/ubuntu resolute/main armhf dh-strip-nondeterminism all 1.15.0-1 [5090 B] 155s Get:60 http://ftpmaster.internal/ubuntu resolute/main armhf libdw1t64 armhf 0.194-1 [254 kB] 155s Get:61 http://ftpmaster.internal/ubuntu resolute/main armhf debugedit armhf 1:5.2-3 [48.9 kB] 155s Get:62 http://ftpmaster.internal/ubuntu resolute/main armhf dwz armhf 0.16-2 [114 kB] 155s Get:63 http://ftpmaster.internal/ubuntu resolute/main armhf gettext armhf 0.23.2-1 [1059 kB] 155s Get:64 http://ftpmaster.internal/ubuntu resolute/main armhf intltool-debian all 0.35.0+20060710.6 [23.2 kB] 155s Get:65 http://ftpmaster.internal/ubuntu resolute/main armhf po-debconf all 1.0.21+nmu1 [233 kB] 155s Get:66 http://ftpmaster.internal/ubuntu resolute/main armhf debhelper all 13.24.2ubuntu1 [896 kB] 155s Get:67 http://ftpmaster.internal/ubuntu resolute/universe armhf dh-python all 6.20250414 [119 kB] 155s Get:68 http://ftpmaster.internal/ubuntu resolute/main armhf sgml-base all 1.31+nmu1 [11.0 kB] 155s Get:69 http://ftpmaster.internal/ubuntu resolute/main armhf xml-core all 0.19 [20.3 kB] 155s Get:70 http://ftpmaster.internal/ubuntu resolute/main armhf docutils-common all 0.21.2+dfsg-2 [131 kB] 155s Get:71 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 155s Get:72 http://ftpmaster.internal/ubuntu resolute/universe armhf fonts-lyx all 2.4.4-2 [171 kB] 155s Get:73 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 156s Get:74 http://ftpmaster.internal/ubuntu resolute/universe armhf fonts-open-sans all 1.11-2 [635 kB] 156s Get:75 http://ftpmaster.internal/ubuntu resolute/main armhf libbabeltrace1 armhf 1.5.11-4build3 [155 kB] 156s Get:76 http://ftpmaster.internal/ubuntu resolute/main armhf libdebuginfod1t64 armhf 0.194-1 [18.8 kB] 156s Get:77 http://ftpmaster.internal/ubuntu resolute/main armhf libpython3.13 armhf 3.13.9-1 [2123 kB] 156s Get:78 http://ftpmaster.internal/ubuntu resolute/main armhf libsource-highlight-common all 3.1.9-4.3build1 [64.2 kB] 156s Get:79 http://ftpmaster.internal/ubuntu resolute/main armhf libsource-highlight4t64 armhf 3.1.9-4.3build1 [306 kB] 156s Get:80 http://ftpmaster.internal/ubuntu resolute/main armhf libc6-dbg armhf 2.42-2ubuntu2 [4514 kB] 156s Get:81 http://ftpmaster.internal/ubuntu resolute/main armhf gdb armhf 16.3-1ubuntu2 [3667 kB] 157s Get:82 http://ftpmaster.internal/ubuntu resolute/main armhf python3-decorator all 5.2.1-2 [28.1 kB] 157s Get:83 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-parso all 0.8.5-1 [68.0 kB] 157s Get:84 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-typeshed all 0.0~git20241223.ea91db2-4 [1554 kB] 157s Get:85 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-jedi all 0.19.1+ds1-1 [693 kB] 157s Get:86 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-traitlets all 5.14.3+really5.14.3-1 [71.5 kB] 157s Get:87 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-matplotlib-inline all 0.1.7-1 [9186 B] 157s Get:88 http://ftpmaster.internal/ubuntu resolute/main armhf python3-wcwidth all 0.2.13+dfsg1-1 [26.3 kB] 157s Get:89 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-prompt-toolkit all 3.0.52-1 [258 kB] 157s Get:90 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-asttokens all 3.0.0-2 [20.5 kB] 157s Get:91 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-executing all 2.2.0-0.2 [25.0 kB] 157s Get:92 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pure-eval all 0.2.3-1 [11.4 kB] 157s Get:93 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-stack-data all 0.6.3-1 [22.0 kB] 157s Get:94 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-ipython all 8.35.0-2 [575 kB] 157s Get:95 http://ftpmaster.internal/ubuntu resolute/universe armhf ipython3 all 8.35.0-2 [4908 B] 157s Get:96 http://ftpmaster.internal/ubuntu resolute/universe armhf libaec0 armhf 1.1.4-2 [21.1 kB] 157s Get:97 http://ftpmaster.internal/ubuntu resolute/main armhf libsnappy1v5 armhf 1.2.2-2 [28.6 kB] 157s Get:98 http://ftpmaster.internal/ubuntu resolute/universe armhf libblosc1 armhf 1.21.5+ds-2 [23.7 kB] 157s Get:99 http://ftpmaster.internal/ubuntu resolute/main armhf libcares2 armhf 1.34.5-1 [85.3 kB] 157s Get:100 http://ftpmaster.internal/ubuntu resolute/main armhf libdeflate0 armhf 1.23-2 [38.7 kB] 157s Get:101 http://ftpmaster.internal/ubuntu resolute/universe armhf libgeos3.13.1 armhf 3.13.1-1 [946 kB] 157s Get:102 http://ftpmaster.internal/ubuntu resolute/universe armhf libgeos-c1t64 armhf 3.13.1-1 [96.8 kB] 158s Get:103 http://ftpmaster.internal/ubuntu resolute/main armhf libgraphite2-3 armhf 1.3.14-2ubuntu1 [64.8 kB] 158s Get:104 http://ftpmaster.internal/ubuntu resolute/main armhf libharfbuzz0b armhf 12.1.0-1 [512 kB] 158s Get:105 http://ftpmaster.internal/ubuntu resolute/universe armhf libsz2 armhf 1.1.4-2 [5322 B] 158s Get:106 http://ftpmaster.internal/ubuntu resolute/universe armhf libhdf5-310 armhf 1.14.5+repack-4 [1422 kB] 158s Get:107 http://ftpmaster.internal/ubuntu resolute/universe armhf libhdf5-hl-310 armhf 1.14.5+repack-4 [58.7 kB] 158s Get:108 http://ftpmaster.internal/ubuntu resolute/main armhf libimagequant0 armhf 2.18.0-1build1 [31.1 kB] 158s Get:109 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg-turbo8 armhf 2.1.5-4ubuntu2 [127 kB] 158s Get:110 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 158s Get:111 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 158s Get:112 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 158s Get:113 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-sphinxdoc all 8.2.3-1ubuntu2 [28.0 kB] 158s Get:114 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-sprintf-js all 1.1.2+ds1+~1.1.2-1 [12.8 kB] 158s Get:115 http://ftpmaster.internal/ubuntu resolute/main armhf libjson-perl all 4.10000-1 [81.9 kB] 158s Get:116 http://ftpmaster.internal/ubuntu resolute/main armhf liblcms2-2 armhf 2.17-1 [139 kB] 158s Get:117 http://ftpmaster.internal/ubuntu resolute/main armhf liblerc4 armhf 4.0.0+ds-5ubuntu1 [160 kB] 158s Get:118 http://ftpmaster.internal/ubuntu resolute/main armhf liblua5.4-0 armhf 5.4.8-1 [134 kB] 158s Get:119 http://ftpmaster.internal/ubuntu resolute/universe armhf liblzf1 armhf 3.6-4 [6554 B] 158s Get:120 http://ftpmaster.internal/ubuntu resolute/universe armhf libnetcdf22 armhf 1:4.9.3-1build1 [511 kB] 158s Get:121 http://ftpmaster.internal/ubuntu resolute/universe armhf node-xtend all 4.0.2-3 [3902 B] 158s Get:122 http://ftpmaster.internal/ubuntu resolute/universe armhf node-corepack all 0.24.0-5 [757 kB] 158s Get:123 http://ftpmaster.internal/ubuntu resolute/universe armhf nodejs armhf 20.19.4+dfsg-1 [342 kB] 158s Get:124 http://ftpmaster.internal/ubuntu resolute/universe armhf node-acorn all 8.8.1+ds+~cs25.17.7-2 [115 kB] 158s Get:125 http://ftpmaster.internal/ubuntu resolute/universe armhf node-cjs-module-lexer all 1.2.3+dfsg-1 [32.1 kB] 158s Get:126 http://ftpmaster.internal/ubuntu resolute/universe armhf node-balanced-match all 2.0.0-1 [4910 B] 158s Get:127 http://ftpmaster.internal/ubuntu resolute/universe armhf node-brace-expansion all 2.0.1+~1.1.0-2 [8172 B] 158s Get:128 http://ftpmaster.internal/ubuntu resolute/universe armhf node-minimatch all 9.0.3-6 [78.0 kB] 158s Get:129 http://ftpmaster.internal/ubuntu resolute/universe armhf node-ms all 2.1.3+~cs0.7.31-3 [5738 B] 158s Get:130 http://ftpmaster.internal/ubuntu resolute/universe armhf node-debug all 4.4.1+~4.1.12-1 [17.7 kB] 158s Get:131 http://ftpmaster.internal/ubuntu resolute/universe armhf node-lru-cache all 10.0.1-3 [61.9 kB] 158s Get:132 http://ftpmaster.internal/ubuntu resolute/universe armhf node-semver all 7.6.1+~7.5.8-2 [45.2 kB] 158s Get:133 http://ftpmaster.internal/ubuntu resolute/universe armhf node-llhttp all 9.3.3~really9.3.0+~cs12.11.8-3 [158 kB] 159s Get:134 http://ftpmaster.internal/ubuntu resolute/universe armhf node-undici all 7.16.0+dfsg+~cs3.2.0-2 [380 kB] 159s Get:135 http://ftpmaster.internal/ubuntu resolute/universe armhf libnode115 armhf 20.19.4+dfsg-1 [12.3 MB] 159s Get:136 http://ftpmaster.internal/ubuntu resolute/universe armhf libnorm1t64 armhf 1.5.9+dfsg-4 [210 kB] 159s Get:137 http://ftpmaster.internal/ubuntu resolute/universe armhf libpgm-5.3-0t64 armhf 5.3.128~dfsg-2.1build1 [171 kB] 159s Get:138 http://ftpmaster.internal/ubuntu resolute/universe armhf proj-data all 9.7.0-1 [7970 kB] 160s Get:139 http://ftpmaster.internal/ubuntu resolute/main armhf libjbig0 armhf 2.1-6.1ubuntu2 [24.9 kB] 160s Get:140 http://ftpmaster.internal/ubuntu resolute/main armhf libsharpyuv0 armhf 1.5.0-0.1 [16.4 kB] 160s Get:141 http://ftpmaster.internal/ubuntu resolute/main armhf libwebp7 armhf 1.5.0-0.1 [188 kB] 160s Get:142 http://ftpmaster.internal/ubuntu resolute/main armhf libtiff6 armhf 4.7.0-3ubuntu3 [188 kB] 160s Get:143 http://ftpmaster.internal/ubuntu resolute/universe armhf libproj25 armhf 9.7.0-1 [1362 kB] 160s Get:144 http://ftpmaster.internal/ubuntu resolute/main armhf libpython3.14-stdlib armhf 3.14.0-4 [2270 kB] 160s Get:145 http://ftpmaster.internal/ubuntu resolute/universe armhf libqhull-r8.0 armhf 2020.2-7 [174 kB] 160s Get:146 http://ftpmaster.internal/ubuntu resolute/main armhf libraqm0 armhf 0.10.3-1 [12.7 kB] 160s Get:147 http://ftpmaster.internal/ubuntu resolute/main armhf libsodium23 armhf 1.0.18-1build3 [139 kB] 160s Get:148 http://ftpmaster.internal/ubuntu resolute/main armhf libwebpdemux2 armhf 1.5.0-0.1 [11.5 kB] 160s Get:149 http://ftpmaster.internal/ubuntu resolute/main armhf libwebpmux3 armhf 1.5.0-0.1 [22.4 kB] 160s Get:150 http://ftpmaster.internal/ubuntu resolute/main armhf libxslt1.1 armhf 1.1.43-0.3 [146 kB] 160s Get:151 http://ftpmaster.internal/ubuntu resolute/universe armhf libzmq5 armhf 4.3.5-1build2 [262 kB] 160s Get:152 http://ftpmaster.internal/ubuntu resolute/universe armhf libzopfli1 armhf 1.0.3-3 [91.7 kB] 160s Get:153 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-mypy-extensions all 1.1.0-1 [6716 B] 160s Get:154 http://ftpmaster.internal/ubuntu resolute/main armhf python3-psutil armhf 7.1.0-1ubuntu1 [189 kB] 160s Get:155 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-mypy armhf 1.15.0-5 [9395 kB] 160s Get:156 http://ftpmaster.internal/ubuntu resolute/universe armhf mypy all 1.15.0-5 [25.4 kB] 160s Get:157 http://ftpmaster.internal/ubuntu resolute/universe armhf node-esprima all 4.0.1+ds+~4.0.3-2 [69.3 kB] 160s Get:158 http://ftpmaster.internal/ubuntu resolute/universe armhf node-fortawesome-fontawesome-free all 6.7.2+ds1-1 [1653 kB] 160s Get:159 http://ftpmaster.internal/ubuntu resolute/universe armhf node-sprintf-js all 1.1.2+ds1+~1.1.2-1 [3916 B] 160s Get:160 http://ftpmaster.internal/ubuntu resolute/universe armhf node-argparse all 2.0.1-2 [33.2 kB] 160s Get:161 http://ftpmaster.internal/ubuntu resolute/universe armhf node-js-yaml all 4.1.0+dfsg+~4.0.5-7 [61.9 kB] 160s Get:162 http://ftpmaster.internal/ubuntu resolute/universe armhf pandoc-data all 3.1.11.1-3build1 [78.8 kB] 160s Get:163 http://ftpmaster.internal/ubuntu resolute/universe armhf pandoc armhf 3.1.11.1+ds-4 [36.7 MB] 162s Get:164 http://ftpmaster.internal/ubuntu resolute/universe armhf pybuild-plugin-autopkgtest all 6.20250414 [1746 B] 162s Get:165 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 162s Get:166 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-wheel all 0.46.1-2 [22.1 kB] 162s Get:167 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-build all 1.2.2-4 [31.0 kB] 162s Get:168 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-installer all 0.7.0+dfsg1-3 [17.4 kB] 162s Get:169 http://ftpmaster.internal/ubuntu resolute/universe armhf pybuild-plugin-pyproject all 6.20250414 [1728 B] 162s Get:170 http://ftpmaster.internal/ubuntu resolute/universe armhf python-cartopy-data all 0.25.0+dfsg-1 [6537 kB] 162s Get:171 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 162s Get:172 http://ftpmaster.internal/ubuntu resolute/universe armhf python-dask-doc all 2024.12.1+dfsg-2 [10.4 MB] 163s Get:173 http://ftpmaster.internal/ubuntu resolute/universe armhf python-matplotlib-data all 3.10.7+dfsg1-1 [2930 kB] 163s Get:174 http://ftpmaster.internal/ubuntu resolute/universe armhf python-pandas-doc all 2.3.3+dfsg-1ubuntu1 [14.1 MB] 163s Get:175 http://ftpmaster.internal/ubuntu resolute/universe armhf python-tinycss2-common all 1.4.0-2 [47.0 kB] 163s Get:176 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-requirejs all 2.3.7+ds+~2.1.37-1 [201 kB] 163s Get:177 http://ftpmaster.internal/ubuntu resolute/universe armhf python-xarray-doc all 2025.03.1-8 [5284 kB] 164s Get:178 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-accessible-pygments all 0.0.5-2 [790 kB] 164s Get:179 http://ftpmaster.internal/ubuntu resolute/main armhf python3.14 armhf 3.14.0-4 [805 kB] 164s Get:180 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf python3-all armhf 3.13.7-2 [890 B] 164s Get:181 http://ftpmaster.internal/ubuntu resolute/main armhf python3-defusedxml all 0.7.1-3 [42.2 kB] 164s Get:182 http://ftpmaster.internal/ubuntu resolute/main armhf sphinx-common all 8.2.3-1ubuntu2 [656 kB] 164s Get:183 http://ftpmaster.internal/ubuntu resolute/main armhf python3-alabaster all 0.7.16-0.1 [18.5 kB] 164s Get:184 http://ftpmaster.internal/ubuntu resolute/main armhf python3-roman all 5.1-1 [10.6 kB] 164s Get:185 http://ftpmaster.internal/ubuntu resolute/main armhf python3-docutils all 0.21.2+dfsg-2 [409 kB] 164s Get:186 http://ftpmaster.internal/ubuntu resolute/main armhf python3-imagesize all 1.4.1-1 [6844 B] 164s Get:187 http://ftpmaster.internal/ubuntu resolute/main armhf python3-snowballstemmer all 3.0.1-1 [65.9 kB] 164s Get:188 http://ftpmaster.internal/ubuntu resolute/main armhf python3-sphinx all 8.2.3-1ubuntu2 [482 kB] 164s Get:189 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-autodocsumm all 0.2.14-2 [11.9 kB] 164s Get:190 http://ftpmaster.internal/ubuntu resolute/main armhf python3-webencodings all 0.5.1-5 [11.5 kB] 164s Get:191 http://ftpmaster.internal/ubuntu resolute/main armhf python3-html5lib all 1.2-2 [90.6 kB] 164s Get:192 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-bleach all 6.2.0-1 [43.9 kB] 164s Get:193 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-bottleneck armhf 1.4.2+ds1-2build2 [100 kB] 164s Get:194 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-brotli armhf 1.1.0-2build6 [327 kB] 164s Get:195 http://ftpmaster.internal/ubuntu resolute/main armhf python3-soupsieve all 2.7-2 [33.6 kB] 164s Get:196 http://ftpmaster.internal/ubuntu resolute/main armhf python3-bs4 all 4.13.4-3 [137 kB] 164s Get:197 http://ftpmaster.internal/ubuntu resolute/main armhf libopenjp2-7 armhf 2.5.3-2.1 [174 kB] 164s Get:198 http://ftpmaster.internal/ubuntu resolute/main armhf python3-pil armhf 11.3.0-1ubuntu2 [465 kB] 164s Get:199 http://ftpmaster.internal/ubuntu resolute/main armhf python3.14-tk armhf 3.14.0-4 [105 kB] 164s Get:200 http://ftpmaster.internal/ubuntu resolute/main armhf python3.13-tk armhf 3.13.9-1 [104 kB] 164s Get:201 http://ftpmaster.internal/ubuntu resolute/main armhf python3-tk armhf 3.13.9-1 [8944 B] 164s Get:202 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pil.imagetk armhf 11.3.0-1ubuntu2 [9236 B] 164s Get:203 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-contourpy armhf 1.3.1-2 [267 kB] 165s Get:204 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-cycler all 0.12.1-2 [9850 B] 165s Get:205 http://ftpmaster.internal/ubuntu resolute/main armhf python3-platformdirs all 4.3.7-1 [16.9 kB] 165s Get:206 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-fs all 2.4.16-9ubuntu1 [91.5 kB] 165s Get:207 http://ftpmaster.internal/ubuntu resolute/main armhf python3-lxml armhf 6.0.2-1 [2260 kB] 165s Get:208 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-lz4 armhf 4.4.4+dfsg-3 [25.9 kB] 165s Get:209 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-scipy armhf 1.15.3-1ubuntu1 [19.7 MB] 166s Get:210 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-mpmath all 1.3.0-2 [423 kB] 166s Get:211 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sympy all 1.14.0-2 [4306 kB] 167s Get:212 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-ufolib2 all 0.17.1+dfsg1-1 [33.5 kB] 167s Get:213 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-zopfli armhf 0.4.0-1 [10.5 kB] 167s Get:214 http://ftpmaster.internal/ubuntu resolute/universe armhf unicode-data all 16.0.0-1 [9513 kB] 167s Get:215 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-fonttools armhf 4.57.0-2build1 [1688 kB] 167s Get:216 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-kiwisolver armhf 1.4.10~rc0-1 [77.8 kB] 167s Get:217 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-matplotlib armhf 3.10.7+dfsg1-1 [17.2 MB] 169s Get:218 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pyproj armhf 3.7.2-1 [603 kB] 169s Get:219 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pyshp all 2.3.1-3 [61.8 kB] 169s Get:220 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-shapely armhf 2.1.2-1 [399 kB] 169s Get:221 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-cartopy armhf 0.25.0+dfsg-1 [520 kB] 169s Get:222 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-cftime armhf 1.6.5-1 [506 kB] 169s Get:223 http://ftpmaster.internal/ubuntu resolute/main armhf python3-click all 8.2.0+0.really.8.1.8-1 [80.0 kB] 169s Get:224 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-cloudpickle all 3.1.1-1 [22.4 kB] 169s Get:225 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-comm all 0.2.1-1 [7016 B] 169s Get:226 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-coverage armhf 7.8.2+dfsg1-1 [156 kB] 169s Get:227 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-crc32c armhf 2.7.1-1build1 [22.7 kB] 169s Get:228 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-fsspec all 2025.3.2-1ubuntu1 [217 kB] 169s Get:229 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-toolz all 1.0.0-2 [45.0 kB] 169s Get:230 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-locket all 1.0.0-2 [5872 B] 169s Get:231 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-partd all 1.4.2-1 [15.7 kB] 169s Get:232 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-dask all 2024.12.1+dfsg-2 [875 kB] 169s Get:233 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-debugpy armhf 1.8.12+ds-1ubuntu1 [747 kB] 169s Get:234 http://ftpmaster.internal/ubuntu resolute/main armhf python3.13-doc all 3.13.9-1 [14.3 MB] 170s Get:235 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf python3-doc all 3.13.7-2 [10.8 kB] 170s Get:236 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-donfig all 0.8.1+dfsg-3 [17.3 kB] 170s Get:237 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-execnet all 2.1.1-1 [33.4 kB] 170s Get:238 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-fastjsonschema all 2.21.1-1 [20.4 kB] 170s Get:239 http://ftpmaster.internal/ubuntu resolute/main armhf python3-flexcache all 0.3-2 [13.4 kB] 170s Get:240 http://ftpmaster.internal/ubuntu resolute/main armhf python3-flexparser all 0.4-1 [43.8 kB] 170s Get:241 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-h5py-serial armhf 3.13.0-1ubuntu1 [1109 kB] 170s Get:242 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-h5py all 3.13.0-1ubuntu1 [8230 B] 170s Get:243 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-h5netcdf all 1.6.1-1 [46.7 kB] 170s Get:244 http://ftpmaster.internal/ubuntu resolute/main armhf python3-sortedcontainers all 2.4.0-2 [27.6 kB] 170s Get:245 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-hypothesis all 6.130.5-2 [341 kB] 170s Get:246 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-iniconfig all 2.1.0-1 [6840 B] 170s Get:247 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-jupyter-core all 5.7.2-5 [28.1 kB] 170s Get:248 http://ftpmaster.internal/ubuntu resolute/main armhf python3-tornado armhf 6.5.2-3 [304 kB] 170s Get:249 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-zmq armhf 27.1.0-1 [223 kB] 170s Get:250 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-jupyter-client all 8.6.3-3 [78.4 kB] 171s Get:251 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-nest-asyncio all 1.5.4-1 [6256 B] 171s Get:252 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-ipykernel all 6.29.5-2 [82.7 kB] 171s Get:253 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-jupyter-console all 6.6.3-2 [21.6 kB] 171s Get:254 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-jupyterlab-pygments all 0.2.2-3 [6054 B] 171s Get:255 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-mistune all 3.1.4-1 [35.0 kB] 171s Get:256 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-nbformat all 5.9.1-1 [41.2 kB] 171s Get:257 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-nbclient all 0.8.0-2 [53.9 kB] 171s Get:258 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-tinycss2 all 1.4.0-2 [22.5 kB] 171s Get:259 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pandocfilters all 1.5.1-1 [23.6 kB] 171s Get:260 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-nbconvert all 7.16.6-1 [140 kB] 171s Get:261 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-nbsphinx all 0.9.5+ds-1 [41.0 kB] 171s Get:262 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-netcdf4 armhf 1.7.2-1build4 [601 kB] 171s Get:263 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pydata-sphinx-theme all 0.16.1+dfsg-3 [959 kB] 171s Get:264 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-numcodecs armhf 0.16.3+ds-1 [505 kB] 171s Get:265 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-numpydoc all 1.9.0-1 [53.2 kB] 171s Get:266 http://ftpmaster.internal/ubuntu resolute/main armhf python3-pytz all 2025.2-4 [32.3 kB] 171s Get:267 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pandas-lib armhf 2.3.3+dfsg-1ubuntu1 [8020 kB] 171s Get:268 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pandas all 2.3.3+dfsg-1ubuntu1 [2948 kB] 172s Get:269 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pickleshare all 0.7.5-5 [7570 B] 172s Get:270 http://ftpmaster.internal/ubuntu resolute/main armhf python3-pint all 0.24.4-2 [203 kB] 172s Get:271 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pip all 25.1.1+dfsg-1ubuntu2 [1416 kB] 172s Get:272 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pluggy all 1.6.0-1 [21.0 kB] 172s Get:273 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pooch all 1.8.2-1 [49.9 kB] 172s Get:274 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pytest all 8.3.5-2 [252 kB] 172s Get:275 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-regex armhf 0.1.20250918-1 [294 kB] 172s Get:276 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-tomlkit all 0.13.3-2 [39.1 kB] 172s Get:277 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pytest-mypy all 3.2.0-2 [21.6 kB] 172s Get:278 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-pytest-xdist all 3.8.0-2 [34.6 kB] 172s Get:279 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-seaborn all 0.13.2-5 [225 kB] 172s Get:280 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-setuptools-scm all 8.2.1-3 [32.7 kB] 172s Get:281 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-book-theme all 1.1.4-2 [83.3 kB] 172s Get:282 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-copybutton all 0.5.2-3 [16.7 kB] 172s Get:283 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-design all 0.6.1-2 [894 kB] 172s Get:284 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-gallery all 0.17.1-1 [334 kB] 172s Get:285 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-inline-tabs all 2023.4.21-3 [39.2 kB] 172s Get:286 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-remove-toctrees all 1.0.0-1 [6198 B] 172s Get:287 http://ftpmaster.internal/ubuntu resolute/main armhf sphinx-rtd-theme-common all 3.0.2+dfsg-3 [1013 kB] 172s Get:288 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinxcontrib.jquery all 4.1-6 [6856 B] 172s Get:289 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinx-rtd-theme all 3.0.2+dfsg-3 [23.5 kB] 172s Get:290 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinxcontrib-mermaid all 1.0.0-1 [4844 kB] 172s Get:291 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinxext-opengraph all 0.12.0-1 [873 kB] 173s Get:292 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-sphinxext-rediraffe all 0.3.0-1 [8414 B] 173s Get:293 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-xarray all 2025.03.1-8 [831 kB] 173s Get:294 http://ftpmaster.internal/ubuntu resolute/universe armhf python3-zarr all 3.1.3-1 [2192 kB] 173s Get:295 http://ftpmaster.internal/ubuntu resolute/main armhf tzdata-legacy all 2025b-5ubuntu1 [99.3 kB] 173s Get:296 http://ftpmaster.internal/ubuntu resolute/universe armhf python-hypothesis-doc all 6.130.5-2 [563 kB] 173s Get:297 http://ftpmaster.internal/ubuntu resolute/universe armhf python-scipy-doc all 1.15.3-1ubuntu1 [26.6 kB] 174s Preconfiguring packages ... 175s Fetched 329 MB in 23s (14.4 MB/s) 175s Selecting previously unselected package fonts-lato. 175s (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 ... 65904 files and directories currently installed.) 175s Preparing to unpack .../000-fonts-lato_2.015-1_all.deb ... 175s Unpacking fonts-lato (2.015-1) ... 175s Selecting previously unselected package libdebuginfod-common. 175s Preparing to unpack .../001-libdebuginfod-common_0.194-1_all.deb ... 175s Unpacking libdebuginfod-common (0.194-1) ... 175s Selecting previously unselected package python3-numpy-dev:armhf. 175s Preparing to unpack .../002-python3-numpy-dev_1%3a2.3.4+ds-3ubuntu1_armhf.deb ... 175s Unpacking python3-numpy-dev:armhf (1:2.3.4+ds-3ubuntu1) ... 175s Selecting previously unselected package libblas3:armhf. 175s Preparing to unpack .../003-libblas3_3.12.1-7_armhf.deb ... 175s Unpacking libblas3:armhf (3.12.1-7) ... 175s Selecting previously unselected package libgfortran5:armhf. 175s Preparing to unpack .../004-libgfortran5_15.2.0-7ubuntu1_armhf.deb ... 175s Unpacking libgfortran5:armhf (15.2.0-7ubuntu1) ... 175s Selecting previously unselected package liblapack3:armhf. 175s Preparing to unpack .../005-liblapack3_3.12.1-7_armhf.deb ... 175s Unpacking liblapack3:armhf (3.12.1-7) ... 175s Selecting previously unselected package python3-numpy. 175s Preparing to unpack .../006-python3-numpy_1%3a2.3.4+ds-3ubuntu1_armhf.deb ... 175s Unpacking python3-numpy (1:2.3.4+ds-3ubuntu1) ... 176s Selecting previously unselected package libpython3.14-minimal:armhf. 176s Preparing to unpack .../007-libpython3.14-minimal_3.14.0-4_armhf.deb ... 176s Unpacking libpython3.14-minimal:armhf (3.14.0-4) ... 176s Selecting previously unselected package python3.14-minimal. 176s Preparing to unpack .../008-python3.14-minimal_3.14.0-4_armhf.deb ... 176s Unpacking python3.14-minimal (3.14.0-4) ... 176s Selecting previously unselected package m4. 176s Preparing to unpack .../009-m4_1.4.20-2_armhf.deb ... 176s Unpacking m4 (1.4.20-2) ... 176s Selecting previously unselected package autoconf. 176s Preparing to unpack .../010-autoconf_2.72-3.1ubuntu1_all.deb ... 176s Unpacking autoconf (2.72-3.1ubuntu1) ... 176s Selecting previously unselected package autotools-dev. 176s Preparing to unpack .../011-autotools-dev_20240727.1_all.deb ... 176s Unpacking autotools-dev (20240727.1) ... 176s Selecting previously unselected package automake. 176s Preparing to unpack .../012-automake_1%3a1.18.1-2_all.deb ... 176s Unpacking automake (1:1.18.1-2) ... 176s Selecting previously unselected package autopoint. 176s Preparing to unpack .../013-autopoint_0.23.2-1_all.deb ... 176s Unpacking autopoint (0.23.2-1) ... 176s Selecting previously unselected package libtcl8.6:armhf. 176s Preparing to unpack .../014-libtcl8.6_8.6.17+dfsg-1_armhf.deb ... 176s Unpacking libtcl8.6:armhf (8.6.17+dfsg-1) ... 176s Selecting previously unselected package libfreetype6:armhf. 176s Preparing to unpack .../015-libfreetype6_2.13.3+dfsg-1build1_armhf.deb ... 176s Unpacking libfreetype6:armhf (2.13.3+dfsg-1build1) ... 176s Selecting previously unselected package fonts-dejavu-mono. 176s Preparing to unpack .../016-fonts-dejavu-mono_2.37-8_all.deb ... 176s Unpacking fonts-dejavu-mono (2.37-8) ... 176s Selecting previously unselected package fonts-dejavu-core. 176s Preparing to unpack .../017-fonts-dejavu-core_2.37-8_all.deb ... 177s Unpacking fonts-dejavu-core (2.37-8) ... 177s Selecting previously unselected package fontconfig-config. 177s Preparing to unpack .../018-fontconfig-config_2.15.0-2.3ubuntu1_armhf.deb ... 177s Unpacking fontconfig-config (2.15.0-2.3ubuntu1) ... 177s Selecting previously unselected package libfontconfig1:armhf. 177s Preparing to unpack .../019-libfontconfig1_2.15.0-2.3ubuntu1_armhf.deb ... 177s Unpacking libfontconfig1:armhf (2.15.0-2.3ubuntu1) ... 177s Selecting previously unselected package libxrender1:armhf. 177s Preparing to unpack .../020-libxrender1_1%3a0.9.12-1_armhf.deb ... 177s Unpacking libxrender1:armhf (1:0.9.12-1) ... 177s Selecting previously unselected package libxft2:armhf. 177s Preparing to unpack .../021-libxft2_2.3.6-1build1_armhf.deb ... 177s Unpacking libxft2:armhf (2.3.6-1build1) ... 177s Selecting previously unselected package x11-common. 177s Preparing to unpack .../022-x11-common_1%3a7.7+24ubuntu1_all.deb ... 177s Unpacking x11-common (1:7.7+24ubuntu1) ... 177s Selecting previously unselected package libxss1:armhf. 178s Preparing to unpack .../023-libxss1_1%3a1.2.3-1build3_armhf.deb ... 178s Unpacking libxss1:armhf (1:1.2.3-1build3) ... 178s Selecting previously unselected package libtk8.6:armhf. 178s Preparing to unpack .../024-libtk8.6_8.6.17-1_armhf.deb ... 178s Unpacking libtk8.6:armhf (8.6.17-1) ... 178s Selecting previously unselected package tk8.6-blt2.5. 178s Preparing to unpack .../025-tk8.6-blt2.5_2.5.3+dfsg-8_armhf.deb ... 178s Unpacking tk8.6-blt2.5 (2.5.3+dfsg-8) ... 178s Selecting previously unselected package blt. 178s Preparing to unpack .../026-blt_2.5.3+dfsg-8_armhf.deb ... 178s Unpacking blt (2.5.3+dfsg-8) ... 178s Selecting previously unselected package libc-dev-bin. 178s Preparing to unpack .../027-libc-dev-bin_2.42-2ubuntu2_armhf.deb ... 178s Unpacking libc-dev-bin (2.42-2ubuntu2) ... 178s Selecting previously unselected package linux-libc-dev:armhf. 178s Preparing to unpack .../028-linux-libc-dev_6.17.0-5.5_armhf.deb ... 178s Unpacking linux-libc-dev:armhf (6.17.0-5.5) ... 178s Selecting previously unselected package libcrypt-dev:armhf. 178s Preparing to unpack .../029-libcrypt-dev_1%3a4.4.38-1build1_armhf.deb ... 178s Unpacking libcrypt-dev:armhf (1:4.4.38-1build1) ... 178s Selecting previously unselected package rpcsvc-proto. 178s Preparing to unpack .../030-rpcsvc-proto_1.4.3-1_armhf.deb ... 178s Unpacking rpcsvc-proto (1.4.3-1) ... 178s Selecting previously unselected package libc6-dev:armhf. 178s Preparing to unpack .../031-libc6-dev_2.42-2ubuntu2_armhf.deb ... 178s Unpacking libc6-dev:armhf (2.42-2ubuntu2) ... 178s Selecting previously unselected package libisl23:armhf. 179s Preparing to unpack .../032-libisl23_0.27-1_armhf.deb ... 179s Unpacking libisl23:armhf (0.27-1) ... 179s Selecting previously unselected package libmpc3:armhf. 179s Preparing to unpack .../033-libmpc3_1.3.1-2_armhf.deb ... 179s Unpacking libmpc3:armhf (1.3.1-2) ... 179s Selecting previously unselected package cpp-15-arm-linux-gnueabihf. 179s Preparing to unpack .../034-cpp-15-arm-linux-gnueabihf_15.2.0-7ubuntu1_armhf.deb ... 179s Unpacking cpp-15-arm-linux-gnueabihf (15.2.0-7ubuntu1) ... 179s Selecting previously unselected package cpp-15. 179s Preparing to unpack .../035-cpp-15_15.2.0-7ubuntu1_armhf.deb ... 179s Unpacking cpp-15 (15.2.0-7ubuntu1) ... 179s Selecting previously unselected package cpp-arm-linux-gnueabihf. 179s Preparing to unpack .../036-cpp-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 179s Unpacking cpp-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 179s Selecting previously unselected package cpp. 179s Preparing to unpack .../037-cpp_4%3a15.2.0-4ubuntu1_armhf.deb ... 179s Unpacking cpp (4:15.2.0-4ubuntu1) ... 179s Selecting previously unselected package libcc1-0:armhf. 179s Preparing to unpack .../038-libcc1-0_15.2.0-7ubuntu1_armhf.deb ... 179s Unpacking libcc1-0:armhf (15.2.0-7ubuntu1) ... 179s Selecting previously unselected package libgomp1:armhf. 179s Preparing to unpack .../039-libgomp1_15.2.0-7ubuntu1_armhf.deb ... 179s Unpacking libgomp1:armhf (15.2.0-7ubuntu1) ... 179s Selecting previously unselected package libasan8:armhf. 179s Preparing to unpack .../040-libasan8_15.2.0-7ubuntu1_armhf.deb ... 179s Unpacking libasan8:armhf (15.2.0-7ubuntu1) ... 180s Selecting previously unselected package libubsan1:armhf. 180s Preparing to unpack .../041-libubsan1_15.2.0-7ubuntu1_armhf.deb ... 180s Unpacking libubsan1:armhf (15.2.0-7ubuntu1) ... 180s Selecting previously unselected package libgcc-15-dev:armhf. 180s Preparing to unpack .../042-libgcc-15-dev_15.2.0-7ubuntu1_armhf.deb ... 180s Unpacking libgcc-15-dev:armhf (15.2.0-7ubuntu1) ... 180s Selecting previously unselected package gcc-15-arm-linux-gnueabihf. 180s Preparing to unpack .../043-gcc-15-arm-linux-gnueabihf_15.2.0-7ubuntu1_armhf.deb ... 180s Unpacking gcc-15-arm-linux-gnueabihf (15.2.0-7ubuntu1) ... 180s Selecting previously unselected package gcc-15. 180s Preparing to unpack .../044-gcc-15_15.2.0-7ubuntu1_armhf.deb ... 180s Unpacking gcc-15 (15.2.0-7ubuntu1) ... 180s Selecting previously unselected package gcc-arm-linux-gnueabihf. 180s Preparing to unpack .../045-gcc-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 180s Unpacking gcc-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 180s Selecting previously unselected package gcc. 180s Preparing to unpack .../046-gcc_4%3a15.2.0-4ubuntu1_armhf.deb ... 180s Unpacking gcc (4:15.2.0-4ubuntu1) ... 181s Selecting previously unselected package libstdc++-15-dev:armhf. 181s Preparing to unpack .../047-libstdc++-15-dev_15.2.0-7ubuntu1_armhf.deb ... 181s Unpacking libstdc++-15-dev:armhf (15.2.0-7ubuntu1) ... 181s Selecting previously unselected package g++-15-arm-linux-gnueabihf. 181s Preparing to unpack .../048-g++-15-arm-linux-gnueabihf_15.2.0-7ubuntu1_armhf.deb ... 181s Unpacking g++-15-arm-linux-gnueabihf (15.2.0-7ubuntu1) ... 181s Selecting previously unselected package g++-15. 181s Preparing to unpack .../049-g++-15_15.2.0-7ubuntu1_armhf.deb ... 181s Unpacking g++-15 (15.2.0-7ubuntu1) ... 181s Selecting previously unselected package g++-arm-linux-gnueabihf. 181s Preparing to unpack .../050-g++-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 181s Unpacking g++-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 181s Selecting previously unselected package g++. 181s Preparing to unpack .../051-g++_4%3a15.2.0-4ubuntu1_armhf.deb ... 181s Unpacking g++ (4:15.2.0-4ubuntu1) ... 181s Selecting previously unselected package build-essential. 181s Preparing to unpack .../052-build-essential_12.12ubuntu1_armhf.deb ... 181s Unpacking build-essential (12.12ubuntu1) ... 181s Selecting previously unselected package libdebhelper-perl. 181s Preparing to unpack .../053-libdebhelper-perl_13.24.2ubuntu1_all.deb ... 181s Unpacking libdebhelper-perl (13.24.2ubuntu1) ... 181s Selecting previously unselected package libtool. 181s Preparing to unpack .../054-libtool_2.5.4-7_all.deb ... 182s Unpacking libtool (2.5.4-7) ... 182s Selecting previously unselected package dh-autoreconf. 182s Preparing to unpack .../055-dh-autoreconf_21_all.deb ... 182s Unpacking dh-autoreconf (21) ... 182s Selecting previously unselected package libarchive-zip-perl. 182s Preparing to unpack .../056-libarchive-zip-perl_1.68-1_all.deb ... 182s Unpacking libarchive-zip-perl (1.68-1) ... 182s Selecting previously unselected package libfile-stripnondeterminism-perl. 182s Preparing to unpack .../057-libfile-stripnondeterminism-perl_1.15.0-1_all.deb ... 182s Unpacking libfile-stripnondeterminism-perl (1.15.0-1) ... 182s Selecting previously unselected package dh-strip-nondeterminism. 182s Preparing to unpack .../058-dh-strip-nondeterminism_1.15.0-1_all.deb ... 182s Unpacking dh-strip-nondeterminism (1.15.0-1) ... 182s Selecting previously unselected package libdw1t64:armhf. 182s Preparing to unpack .../059-libdw1t64_0.194-1_armhf.deb ... 182s Unpacking libdw1t64:armhf (0.194-1) ... 182s Selecting previously unselected package debugedit. 182s Preparing to unpack .../060-debugedit_1%3a5.2-3_armhf.deb ... 182s Unpacking debugedit (1:5.2-3) ... 182s Selecting previously unselected package dwz. 182s Preparing to unpack .../061-dwz_0.16-2_armhf.deb ... 182s Unpacking dwz (0.16-2) ... 182s Selecting previously unselected package gettext. 182s Preparing to unpack .../062-gettext_0.23.2-1_armhf.deb ... 182s Unpacking gettext (0.23.2-1) ... 182s Selecting previously unselected package intltool-debian. 182s Preparing to unpack .../063-intltool-debian_0.35.0+20060710.6_all.deb ... 182s Unpacking intltool-debian (0.35.0+20060710.6) ... 182s Selecting previously unselected package po-debconf. 182s Preparing to unpack .../064-po-debconf_1.0.21+nmu1_all.deb ... 182s Unpacking po-debconf (1.0.21+nmu1) ... 182s Selecting previously unselected package debhelper. 182s Preparing to unpack .../065-debhelper_13.24.2ubuntu1_all.deb ... 182s Unpacking debhelper (13.24.2ubuntu1) ... 182s Selecting previously unselected package dh-python. 182s Preparing to unpack .../066-dh-python_6.20250414_all.deb ... 182s Unpacking dh-python (6.20250414) ... 182s Selecting previously unselected package sgml-base. 183s Preparing to unpack .../067-sgml-base_1.31+nmu1_all.deb ... 183s Unpacking sgml-base (1.31+nmu1) ... 183s Selecting previously unselected package xml-core. 183s Preparing to unpack .../068-xml-core_0.19_all.deb ... 183s Unpacking xml-core (0.19) ... 183s Selecting previously unselected package docutils-common. 183s Preparing to unpack .../069-docutils-common_0.21.2+dfsg-2_all.deb ... 183s Unpacking docutils-common (0.21.2+dfsg-2) ... 183s Selecting previously unselected package fonts-font-awesome. 183s Preparing to unpack .../070-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 183s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 183s Selecting previously unselected package fonts-lyx. 183s Preparing to unpack .../071-fonts-lyx_2.4.4-2_all.deb ... 183s Unpacking fonts-lyx (2.4.4-2) ... 183s Selecting previously unselected package fonts-mathjax. 183s Preparing to unpack .../072-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 183s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 183s Selecting previously unselected package fonts-open-sans. 183s Preparing to unpack .../073-fonts-open-sans_1.11-2_all.deb ... 183s Unpacking fonts-open-sans (1.11-2) ... 183s Selecting previously unselected package libbabeltrace1:armhf. 183s Preparing to unpack .../074-libbabeltrace1_1.5.11-4build3_armhf.deb ... 183s Unpacking libbabeltrace1:armhf (1.5.11-4build3) ... 183s Selecting previously unselected package libdebuginfod1t64:armhf. 183s Preparing to unpack .../075-libdebuginfod1t64_0.194-1_armhf.deb ... 183s Unpacking libdebuginfod1t64:armhf (0.194-1) ... 183s Selecting previously unselected package libpython3.13:armhf. 183s Preparing to unpack .../076-libpython3.13_3.13.9-1_armhf.deb ... 183s Unpacking libpython3.13:armhf (3.13.9-1) ... 183s Selecting previously unselected package libsource-highlight-common. 184s Preparing to unpack .../077-libsource-highlight-common_3.1.9-4.3build1_all.deb ... 184s Unpacking libsource-highlight-common (3.1.9-4.3build1) ... 184s Selecting previously unselected package libsource-highlight4t64:armhf. 184s Preparing to unpack .../078-libsource-highlight4t64_3.1.9-4.3build1_armhf.deb ... 184s Unpacking libsource-highlight4t64:armhf (3.1.9-4.3build1) ... 184s Selecting previously unselected package libc6-dbg:armhf. 184s Preparing to unpack .../079-libc6-dbg_2.42-2ubuntu2_armhf.deb ... 184s Unpacking libc6-dbg:armhf (2.42-2ubuntu2) ... 184s Selecting previously unselected package gdb. 184s Preparing to unpack .../080-gdb_16.3-1ubuntu2_armhf.deb ... 184s Unpacking gdb (16.3-1ubuntu2) ... 184s Selecting previously unselected package python3-decorator. 184s Preparing to unpack .../081-python3-decorator_5.2.1-2_all.deb ... 184s Unpacking python3-decorator (5.2.1-2) ... 184s Selecting previously unselected package python3-parso. 184s Preparing to unpack .../082-python3-parso_0.8.5-1_all.deb ... 184s Unpacking python3-parso (0.8.5-1) ... 184s Selecting previously unselected package python3-typeshed. 184s Preparing to unpack .../083-python3-typeshed_0.0~git20241223.ea91db2-4_all.deb ... 184s Unpacking python3-typeshed (0.0~git20241223.ea91db2-4) ... 185s Selecting previously unselected package python3-jedi. 185s Preparing to unpack .../084-python3-jedi_0.19.1+ds1-1_all.deb ... 185s Unpacking python3-jedi (0.19.1+ds1-1) ... 186s Selecting previously unselected package python3-traitlets. 186s Preparing to unpack .../085-python3-traitlets_5.14.3+really5.14.3-1_all.deb ... 186s Unpacking python3-traitlets (5.14.3+really5.14.3-1) ... 186s Selecting previously unselected package python3-matplotlib-inline. 186s Preparing to unpack .../086-python3-matplotlib-inline_0.1.7-1_all.deb ... 186s Unpacking python3-matplotlib-inline (0.1.7-1) ... 186s Selecting previously unselected package python3-wcwidth. 186s Preparing to unpack .../087-python3-wcwidth_0.2.13+dfsg1-1_all.deb ... 186s Unpacking python3-wcwidth (0.2.13+dfsg1-1) ... 186s Selecting previously unselected package python3-prompt-toolkit. 186s Preparing to unpack .../088-python3-prompt-toolkit_3.0.52-1_all.deb ... 186s Unpacking python3-prompt-toolkit (3.0.52-1) ... 186s Selecting previously unselected package python3-asttokens. 186s Preparing to unpack .../089-python3-asttokens_3.0.0-2_all.deb ... 186s Unpacking python3-asttokens (3.0.0-2) ... 186s Selecting previously unselected package python3-executing. 186s Preparing to unpack .../090-python3-executing_2.2.0-0.2_all.deb ... 186s Unpacking python3-executing (2.2.0-0.2) ... 186s Selecting previously unselected package python3-pure-eval. 186s Preparing to unpack .../091-python3-pure-eval_0.2.3-1_all.deb ... 186s Unpacking python3-pure-eval (0.2.3-1) ... 186s Selecting previously unselected package python3-stack-data. 186s Preparing to unpack .../092-python3-stack-data_0.6.3-1_all.deb ... 186s Unpacking python3-stack-data (0.6.3-1) ... 186s Selecting previously unselected package python3-ipython. 186s Preparing to unpack .../093-python3-ipython_8.35.0-2_all.deb ... 186s Unpacking python3-ipython (8.35.0-2) ... 186s Selecting previously unselected package ipython3. 186s Preparing to unpack .../094-ipython3_8.35.0-2_all.deb ... 186s Unpacking ipython3 (8.35.0-2) ... 186s Selecting previously unselected package libaec0:armhf. 186s Preparing to unpack .../095-libaec0_1.1.4-2_armhf.deb ... 186s Unpacking libaec0:armhf (1.1.4-2) ... 186s Selecting previously unselected package libsnappy1v5:armhf. 186s Preparing to unpack .../096-libsnappy1v5_1.2.2-2_armhf.deb ... 186s Unpacking libsnappy1v5:armhf (1.2.2-2) ... 187s Selecting previously unselected package libblosc1:armhf. 187s Preparing to unpack .../097-libblosc1_1.21.5+ds-2_armhf.deb ... 187s Unpacking libblosc1:armhf (1.21.5+ds-2) ... 187s Selecting previously unselected package libcares2:armhf. 187s Preparing to unpack .../098-libcares2_1.34.5-1_armhf.deb ... 187s Unpacking libcares2:armhf (1.34.5-1) ... 187s Selecting previously unselected package libdeflate0:armhf. 187s Preparing to unpack .../099-libdeflate0_1.23-2_armhf.deb ... 187s Unpacking libdeflate0:armhf (1.23-2) ... 187s Selecting previously unselected package libgeos3.13.1:armhf. 187s Preparing to unpack .../100-libgeos3.13.1_3.13.1-1_armhf.deb ... 187s Unpacking libgeos3.13.1:armhf (3.13.1-1) ... 187s Selecting previously unselected package libgeos-c1t64:armhf. 187s Preparing to unpack .../101-libgeos-c1t64_3.13.1-1_armhf.deb ... 187s Unpacking libgeos-c1t64:armhf (3.13.1-1) ... 187s Selecting previously unselected package libgraphite2-3:armhf. 187s Preparing to unpack .../102-libgraphite2-3_1.3.14-2ubuntu1_armhf.deb ... 187s Unpacking libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 187s Selecting previously unselected package libharfbuzz0b:armhf. 187s Preparing to unpack .../103-libharfbuzz0b_12.1.0-1_armhf.deb ... 187s Unpacking libharfbuzz0b:armhf (12.1.0-1) ... 187s Selecting previously unselected package libsz2:armhf. 187s Preparing to unpack .../104-libsz2_1.1.4-2_armhf.deb ... 187s Unpacking libsz2:armhf (1.1.4-2) ... 187s Selecting previously unselected package libhdf5-310:armhf. 187s Preparing to unpack .../105-libhdf5-310_1.14.5+repack-4_armhf.deb ... 187s Unpacking libhdf5-310:armhf (1.14.5+repack-4) ... 187s Selecting previously unselected package libhdf5-hl-310:armhf. 187s Preparing to unpack .../106-libhdf5-hl-310_1.14.5+repack-4_armhf.deb ... 187s Unpacking libhdf5-hl-310:armhf (1.14.5+repack-4) ... 187s Selecting previously unselected package libimagequant0:armhf. 187s Preparing to unpack .../107-libimagequant0_2.18.0-1build1_armhf.deb ... 187s Unpacking libimagequant0:armhf (2.18.0-1build1) ... 187s Selecting previously unselected package libjpeg-turbo8:armhf. 187s Preparing to unpack .../108-libjpeg-turbo8_2.1.5-4ubuntu2_armhf.deb ... 187s Unpacking libjpeg-turbo8:armhf (2.1.5-4ubuntu2) ... 187s Selecting previously unselected package libjpeg8:armhf. 187s Preparing to unpack .../109-libjpeg8_8c-2ubuntu11_armhf.deb ... 187s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 187s Selecting previously unselected package libjs-jquery. 187s Preparing to unpack .../110-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 187s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 187s Selecting previously unselected package libjs-underscore. 188s Preparing to unpack .../111-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 188s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 188s Selecting previously unselected package libjs-sphinxdoc. 188s Preparing to unpack .../112-libjs-sphinxdoc_8.2.3-1ubuntu2_all.deb ... 188s Unpacking libjs-sphinxdoc (8.2.3-1ubuntu2) ... 188s Selecting previously unselected package libjs-sprintf-js. 188s Preparing to unpack .../113-libjs-sprintf-js_1.1.2+ds1+~1.1.2-1_all.deb ... 188s Unpacking libjs-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 188s Selecting previously unselected package libjson-perl. 188s Preparing to unpack .../114-libjson-perl_4.10000-1_all.deb ... 188s Unpacking libjson-perl (4.10000-1) ... 188s Selecting previously unselected package liblcms2-2:armhf. 188s Preparing to unpack .../115-liblcms2-2_2.17-1_armhf.deb ... 188s Unpacking liblcms2-2:armhf (2.17-1) ... 188s Selecting previously unselected package liblerc4:armhf. 188s Preparing to unpack .../116-liblerc4_4.0.0+ds-5ubuntu1_armhf.deb ... 188s Unpacking liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 188s Selecting previously unselected package liblua5.4-0:armhf. 188s Preparing to unpack .../117-liblua5.4-0_5.4.8-1_armhf.deb ... 188s Unpacking liblua5.4-0:armhf (5.4.8-1) ... 188s Selecting previously unselected package liblzf1:armhf. 188s Preparing to unpack .../118-liblzf1_3.6-4_armhf.deb ... 188s Unpacking liblzf1:armhf (3.6-4) ... 188s Selecting previously unselected package libnetcdf22:armhf. 188s Preparing to unpack .../119-libnetcdf22_1%3a4.9.3-1build1_armhf.deb ... 188s Unpacking libnetcdf22:armhf (1:4.9.3-1build1) ... 188s Selecting previously unselected package node-xtend. 188s Preparing to unpack .../120-node-xtend_4.0.2-3_all.deb ... 188s Unpacking node-xtend (4.0.2-3) ... 188s Selecting previously unselected package node-corepack. 188s Preparing to unpack .../121-node-corepack_0.24.0-5_all.deb ... 188s Unpacking node-corepack (0.24.0-5) ... 188s Selecting previously unselected package nodejs. 188s Preparing to unpack .../122-nodejs_20.19.4+dfsg-1_armhf.deb ... 188s Unpacking nodejs (20.19.4+dfsg-1) ... 188s Selecting previously unselected package node-acorn. 188s Preparing to unpack .../123-node-acorn_8.8.1+ds+~cs25.17.7-2_all.deb ... 188s Unpacking node-acorn (8.8.1+ds+~cs25.17.7-2) ... 188s Selecting previously unselected package node-cjs-module-lexer. 189s Preparing to unpack .../124-node-cjs-module-lexer_1.2.3+dfsg-1_all.deb ... 189s Unpacking node-cjs-module-lexer (1.2.3+dfsg-1) ... 189s Selecting previously unselected package node-balanced-match. 189s Preparing to unpack .../125-node-balanced-match_2.0.0-1_all.deb ... 189s Unpacking node-balanced-match (2.0.0-1) ... 189s Selecting previously unselected package node-brace-expansion. 189s Preparing to unpack .../126-node-brace-expansion_2.0.1+~1.1.0-2_all.deb ... 189s Unpacking node-brace-expansion (2.0.1+~1.1.0-2) ... 189s Selecting previously unselected package node-minimatch. 189s Preparing to unpack .../127-node-minimatch_9.0.3-6_all.deb ... 189s Unpacking node-minimatch (9.0.3-6) ... 189s Selecting previously unselected package node-ms. 189s Preparing to unpack .../128-node-ms_2.1.3+~cs0.7.31-3_all.deb ... 189s Unpacking node-ms (2.1.3+~cs0.7.31-3) ... 189s Selecting previously unselected package node-debug. 189s Preparing to unpack .../129-node-debug_4.4.1+~4.1.12-1_all.deb ... 189s Unpacking node-debug (4.4.1+~4.1.12-1) ... 189s Selecting previously unselected package node-lru-cache. 189s Preparing to unpack .../130-node-lru-cache_10.0.1-3_all.deb ... 189s Unpacking node-lru-cache (10.0.1-3) ... 189s Selecting previously unselected package node-semver. 189s Preparing to unpack .../131-node-semver_7.6.1+~7.5.8-2_all.deb ... 189s Unpacking node-semver (7.6.1+~7.5.8-2) ... 189s Selecting previously unselected package node-llhttp. 189s Preparing to unpack .../132-node-llhttp_9.3.3~really9.3.0+~cs12.11.8-3_all.deb ... 189s Unpacking node-llhttp (9.3.3~really9.3.0+~cs12.11.8-3) ... 189s Selecting previously unselected package node-undici. 189s Preparing to unpack .../133-node-undici_7.16.0+dfsg+~cs3.2.0-2_all.deb ... 189s Unpacking node-undici (7.16.0+dfsg+~cs3.2.0-2) ... 189s Selecting previously unselected package libnode115:armhf. 189s Preparing to unpack .../134-libnode115_20.19.4+dfsg-1_armhf.deb ... 189s Unpacking libnode115:armhf (20.19.4+dfsg-1) ... 190s Selecting previously unselected package libnorm1t64:armhf. 190s Preparing to unpack .../135-libnorm1t64_1.5.9+dfsg-4_armhf.deb ... 190s Unpacking libnorm1t64:armhf (1.5.9+dfsg-4) ... 190s Selecting previously unselected package libpgm-5.3-0t64:armhf. 190s Preparing to unpack .../136-libpgm-5.3-0t64_5.3.128~dfsg-2.1build1_armhf.deb ... 190s Unpacking libpgm-5.3-0t64:armhf (5.3.128~dfsg-2.1build1) ... 190s Selecting previously unselected package proj-data. 190s Preparing to unpack .../137-proj-data_9.7.0-1_all.deb ... 190s Unpacking proj-data (9.7.0-1) ... 190s Selecting previously unselected package libjbig0:armhf. 190s Preparing to unpack .../138-libjbig0_2.1-6.1ubuntu2_armhf.deb ... 190s Unpacking libjbig0:armhf (2.1-6.1ubuntu2) ... 190s Selecting previously unselected package libsharpyuv0:armhf. 190s Preparing to unpack .../139-libsharpyuv0_1.5.0-0.1_armhf.deb ... 190s Unpacking libsharpyuv0:armhf (1.5.0-0.1) ... 191s Selecting previously unselected package libwebp7:armhf. 191s Preparing to unpack .../140-libwebp7_1.5.0-0.1_armhf.deb ... 191s Unpacking libwebp7:armhf (1.5.0-0.1) ... 191s Selecting previously unselected package libtiff6:armhf. 191s Preparing to unpack .../141-libtiff6_4.7.0-3ubuntu3_armhf.deb ... 191s Unpacking libtiff6:armhf (4.7.0-3ubuntu3) ... 191s Selecting previously unselected package libproj25:armhf. 191s Preparing to unpack .../142-libproj25_9.7.0-1_armhf.deb ... 191s Unpacking libproj25:armhf (9.7.0-1) ... 191s Selecting previously unselected package libpython3.14-stdlib:armhf. 191s Preparing to unpack .../143-libpython3.14-stdlib_3.14.0-4_armhf.deb ... 191s Unpacking libpython3.14-stdlib:armhf (3.14.0-4) ... 191s Selecting previously unselected package libqhull-r8.0:armhf. 191s Preparing to unpack .../144-libqhull-r8.0_2020.2-7_armhf.deb ... 191s Unpacking libqhull-r8.0:armhf (2020.2-7) ... 191s Selecting previously unselected package libraqm0:armhf. 191s Preparing to unpack .../145-libraqm0_0.10.3-1_armhf.deb ... 191s Unpacking libraqm0:armhf (0.10.3-1) ... 191s Selecting previously unselected package libsodium23:armhf. 191s Preparing to unpack .../146-libsodium23_1.0.18-1build3_armhf.deb ... 191s Unpacking libsodium23:armhf (1.0.18-1build3) ... 191s Selecting previously unselected package libwebpdemux2:armhf. 191s Preparing to unpack .../147-libwebpdemux2_1.5.0-0.1_armhf.deb ... 191s Unpacking libwebpdemux2:armhf (1.5.0-0.1) ... 191s Selecting previously unselected package libwebpmux3:armhf. 191s Preparing to unpack .../148-libwebpmux3_1.5.0-0.1_armhf.deb ... 191s Unpacking libwebpmux3:armhf (1.5.0-0.1) ... 191s Selecting previously unselected package libxslt1.1:armhf. 191s Preparing to unpack .../149-libxslt1.1_1.1.43-0.3_armhf.deb ... 191s Unpacking libxslt1.1:armhf (1.1.43-0.3) ... 191s Selecting previously unselected package libzmq5:armhf. 191s Preparing to unpack .../150-libzmq5_4.3.5-1build2_armhf.deb ... 191s Unpacking libzmq5:armhf (4.3.5-1build2) ... 191s Selecting previously unselected package libzopfli1. 191s Preparing to unpack .../151-libzopfli1_1.0.3-3_armhf.deb ... 191s Unpacking libzopfli1 (1.0.3-3) ... 192s Selecting previously unselected package python3-mypy-extensions. 192s Preparing to unpack .../152-python3-mypy-extensions_1.1.0-1_all.deb ... 192s Unpacking python3-mypy-extensions (1.1.0-1) ... 192s Selecting previously unselected package python3-psutil. 192s Preparing to unpack .../153-python3-psutil_7.1.0-1ubuntu1_armhf.deb ... 192s Unpacking python3-psutil (7.1.0-1ubuntu1) ... 192s Selecting previously unselected package python3-mypy. 192s Preparing to unpack .../154-python3-mypy_1.15.0-5_armhf.deb ... 192s Unpacking python3-mypy (1.15.0-5) ... 192s Selecting previously unselected package mypy. 192s Preparing to unpack .../155-mypy_1.15.0-5_all.deb ... 192s Unpacking mypy (1.15.0-5) ... 192s Selecting previously unselected package node-esprima. 192s Preparing to unpack .../156-node-esprima_4.0.1+ds+~4.0.3-2_all.deb ... 192s Unpacking node-esprima (4.0.1+ds+~4.0.3-2) ... 192s Selecting previously unselected package node-fortawesome-fontawesome-free. 192s Preparing to unpack .../157-node-fortawesome-fontawesome-free_6.7.2+ds1-1_all.deb ... 192s Unpacking node-fortawesome-fontawesome-free (6.7.2+ds1-1) ... 193s Selecting previously unselected package node-sprintf-js. 193s Preparing to unpack .../158-node-sprintf-js_1.1.2+ds1+~1.1.2-1_all.deb ... 193s Unpacking node-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 193s Selecting previously unselected package node-argparse. 193s Preparing to unpack .../159-node-argparse_2.0.1-2_all.deb ... 193s Unpacking node-argparse (2.0.1-2) ... 193s Selecting previously unselected package node-js-yaml. 193s Preparing to unpack .../160-node-js-yaml_4.1.0+dfsg+~4.0.5-7_all.deb ... 193s Unpacking node-js-yaml (4.1.0+dfsg+~4.0.5-7) ... 193s Selecting previously unselected package pandoc-data. 193s Preparing to unpack .../161-pandoc-data_3.1.11.1-3build1_all.deb ... 193s Unpacking pandoc-data (3.1.11.1-3build1) ... 193s Selecting previously unselected package pandoc. 193s Preparing to unpack .../162-pandoc_3.1.11.1+ds-4_armhf.deb ... 193s Unpacking pandoc (3.1.11.1+ds-4) ... 195s Selecting previously unselected package pybuild-plugin-autopkgtest. 195s Preparing to unpack .../163-pybuild-plugin-autopkgtest_6.20250414_all.deb ... 195s Unpacking pybuild-plugin-autopkgtest (6.20250414) ... 195s Selecting previously unselected package python3-pyproject-hooks. 195s Preparing to unpack .../164-python3-pyproject-hooks_1.2.0-1_all.deb ... 195s Unpacking python3-pyproject-hooks (1.2.0-1) ... 195s Selecting previously unselected package python3-wheel. 195s Preparing to unpack .../165-python3-wheel_0.46.1-2_all.deb ... 195s Unpacking python3-wheel (0.46.1-2) ... 195s Selecting previously unselected package python3-build. 195s Preparing to unpack .../166-python3-build_1.2.2-4_all.deb ... 195s Unpacking python3-build (1.2.2-4) ... 195s Selecting previously unselected package python3-installer. 195s Preparing to unpack .../167-python3-installer_0.7.0+dfsg1-3_all.deb ... 195s Unpacking python3-installer (0.7.0+dfsg1-3) ... 195s Selecting previously unselected package pybuild-plugin-pyproject. 195s Preparing to unpack .../168-pybuild-plugin-pyproject_6.20250414_all.deb ... 195s Unpacking pybuild-plugin-pyproject (6.20250414) ... 196s Selecting previously unselected package python-cartopy-data. 196s Preparing to unpack .../169-python-cartopy-data_0.25.0+dfsg-1_all.deb ... 196s Unpacking python-cartopy-data (0.25.0+dfsg-1) ... 196s Selecting previously unselected package libjs-mathjax. 196s Preparing to unpack .../170-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 196s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 197s Selecting previously unselected package python-dask-doc. 197s Preparing to unpack .../171-python-dask-doc_2024.12.1+dfsg-2_all.deb ... 197s Unpacking python-dask-doc (2024.12.1+dfsg-2) ... 197s Selecting previously unselected package python-matplotlib-data. 197s Preparing to unpack .../172-python-matplotlib-data_3.10.7+dfsg1-1_all.deb ... 197s Unpacking python-matplotlib-data (3.10.7+dfsg1-1) ... 197s Selecting previously unselected package python-pandas-doc. 197s Preparing to unpack .../173-python-pandas-doc_2.3.3+dfsg-1ubuntu1_all.deb ... 197s Unpacking python-pandas-doc (2.3.3+dfsg-1ubuntu1) ... 200s Selecting previously unselected package python-tinycss2-common. 200s Preparing to unpack .../174-python-tinycss2-common_1.4.0-2_all.deb ... 200s Unpacking python-tinycss2-common (1.4.0-2) ... 200s Selecting previously unselected package libjs-requirejs. 200s Preparing to unpack .../175-libjs-requirejs_2.3.7+ds+~2.1.37-1_all.deb ... 200s Unpacking libjs-requirejs (2.3.7+ds+~2.1.37-1) ... 200s Selecting previously unselected package python-xarray-doc. 200s Preparing to unpack .../176-python-xarray-doc_2025.03.1-8_all.deb ... 200s Unpacking python-xarray-doc (2025.03.1-8) ... 200s Selecting previously unselected package python3-accessible-pygments. 200s Preparing to unpack .../177-python3-accessible-pygments_0.0.5-2_all.deb ... 200s Unpacking python3-accessible-pygments (0.0.5-2) ... 200s Selecting previously unselected package python3.14. 200s Preparing to unpack .../178-python3.14_3.14.0-4_armhf.deb ... 200s Unpacking python3.14 (3.14.0-4) ... 200s Selecting previously unselected package python3-all. 200s Preparing to unpack .../179-python3-all_3.13.7-2_armhf.deb ... 200s Unpacking python3-all (3.13.7-2) ... 200s Selecting previously unselected package python3-defusedxml. 200s Preparing to unpack .../180-python3-defusedxml_0.7.1-3_all.deb ... 200s Unpacking python3-defusedxml (0.7.1-3) ... 200s Selecting previously unselected package sphinx-common. 200s Preparing to unpack .../181-sphinx-common_8.2.3-1ubuntu2_all.deb ... 200s Unpacking sphinx-common (8.2.3-1ubuntu2) ... 201s Selecting previously unselected package python3-alabaster. 201s Preparing to unpack .../182-python3-alabaster_0.7.16-0.1_all.deb ... 201s Unpacking python3-alabaster (0.7.16-0.1) ... 201s Selecting previously unselected package python3-roman. 201s Preparing to unpack .../183-python3-roman_5.1-1_all.deb ... 201s Unpacking python3-roman (5.1-1) ... 201s Selecting previously unselected package python3-docutils. 201s Preparing to unpack .../184-python3-docutils_0.21.2+dfsg-2_all.deb ... 201s Unpacking python3-docutils (0.21.2+dfsg-2) ... 201s Selecting previously unselected package python3-imagesize. 201s Preparing to unpack .../185-python3-imagesize_1.4.1-1_all.deb ... 201s Unpacking python3-imagesize (1.4.1-1) ... 201s Selecting previously unselected package python3-snowballstemmer. 201s Preparing to unpack .../186-python3-snowballstemmer_3.0.1-1_all.deb ... 201s Unpacking python3-snowballstemmer (3.0.1-1) ... 201s Selecting previously unselected package python3-sphinx. 201s Preparing to unpack .../187-python3-sphinx_8.2.3-1ubuntu2_all.deb ... 201s Unpacking python3-sphinx (8.2.3-1ubuntu2) ... 201s Selecting previously unselected package python3-autodocsumm. 202s Preparing to unpack .../188-python3-autodocsumm_0.2.14-2_all.deb ... 202s Unpacking python3-autodocsumm (0.2.14-2) ... 202s Selecting previously unselected package python3-webencodings. 202s Preparing to unpack .../189-python3-webencodings_0.5.1-5_all.deb ... 202s Unpacking python3-webencodings (0.5.1-5) ... 202s Selecting previously unselected package python3-html5lib. 202s Preparing to unpack .../190-python3-html5lib_1.2-2_all.deb ... 202s Unpacking python3-html5lib (1.2-2) ... 202s Selecting previously unselected package python3-bleach. 202s Preparing to unpack .../191-python3-bleach_6.2.0-1_all.deb ... 202s Unpacking python3-bleach (6.2.0-1) ... 202s Selecting previously unselected package python3-bottleneck. 202s Preparing to unpack .../192-python3-bottleneck_1.4.2+ds1-2build2_armhf.deb ... 202s Unpacking python3-bottleneck (1.4.2+ds1-2build2) ... 202s Selecting previously unselected package python3-brotli. 202s Preparing to unpack .../193-python3-brotli_1.1.0-2build6_armhf.deb ... 202s Unpacking python3-brotli (1.1.0-2build6) ... 202s Selecting previously unselected package python3-soupsieve. 202s Preparing to unpack .../194-python3-soupsieve_2.7-2_all.deb ... 202s Unpacking python3-soupsieve (2.7-2) ... 202s Selecting previously unselected package python3-bs4. 202s Preparing to unpack .../195-python3-bs4_4.13.4-3_all.deb ... 202s Unpacking python3-bs4 (4.13.4-3) ... 202s Selecting previously unselected package libopenjp2-7:armhf. 202s Preparing to unpack .../196-libopenjp2-7_2.5.3-2.1_armhf.deb ... 202s Unpacking libopenjp2-7:armhf (2.5.3-2.1) ... 202s Selecting previously unselected package python3-pil:armhf. 202s Preparing to unpack .../197-python3-pil_11.3.0-1ubuntu2_armhf.deb ... 202s Unpacking python3-pil:armhf (11.3.0-1ubuntu2) ... 202s Selecting previously unselected package python3.14-tk. 202s Preparing to unpack .../198-python3.14-tk_3.14.0-4_armhf.deb ... 202s Unpacking python3.14-tk (3.14.0-4) ... 202s Selecting previously unselected package python3.13-tk. 202s Preparing to unpack .../199-python3.13-tk_3.13.9-1_armhf.deb ... 202s Unpacking python3.13-tk (3.13.9-1) ... 202s Selecting previously unselected package python3-tk:armhf. 202s Preparing to unpack .../200-python3-tk_3.13.9-1_armhf.deb ... 202s Unpacking python3-tk:armhf (3.13.9-1) ... 202s Selecting previously unselected package python3-pil.imagetk:armhf. 202s Preparing to unpack .../201-python3-pil.imagetk_11.3.0-1ubuntu2_armhf.deb ... 202s Unpacking python3-pil.imagetk:armhf (11.3.0-1ubuntu2) ... 202s Selecting previously unselected package python3-contourpy. 202s Preparing to unpack .../202-python3-contourpy_1.3.1-2_armhf.deb ... 202s Unpacking python3-contourpy (1.3.1-2) ... 202s Selecting previously unselected package python3-cycler. 202s Preparing to unpack .../203-python3-cycler_0.12.1-2_all.deb ... 202s Unpacking python3-cycler (0.12.1-2) ... 202s Selecting previously unselected package python3-platformdirs. 202s Preparing to unpack .../204-python3-platformdirs_4.3.7-1_all.deb ... 202s Unpacking python3-platformdirs (4.3.7-1) ... 203s Selecting previously unselected package python3-fs. 203s Preparing to unpack .../205-python3-fs_2.4.16-9ubuntu1_all.deb ... 203s Unpacking python3-fs (2.4.16-9ubuntu1) ... 203s Selecting previously unselected package python3-lxml:armhf. 203s Preparing to unpack .../206-python3-lxml_6.0.2-1_armhf.deb ... 203s Unpacking python3-lxml:armhf (6.0.2-1) ... 203s Selecting previously unselected package python3-lz4. 203s Preparing to unpack .../207-python3-lz4_4.4.4+dfsg-3_armhf.deb ... 203s Unpacking python3-lz4 (4.4.4+dfsg-3) ... 203s Selecting previously unselected package python3-scipy. 203s Preparing to unpack .../208-python3-scipy_1.15.3-1ubuntu1_armhf.deb ... 203s Unpacking python3-scipy (1.15.3-1ubuntu1) ... 204s Selecting previously unselected package python3-mpmath. 204s Preparing to unpack .../209-python3-mpmath_1.3.0-2_all.deb ... 204s Unpacking python3-mpmath (1.3.0-2) ... 204s Selecting previously unselected package python3-sympy. 204s Preparing to unpack .../210-python3-sympy_1.14.0-2_all.deb ... 204s Unpacking python3-sympy (1.14.0-2) ... 205s Selecting previously unselected package python3-ufolib2. 205s Preparing to unpack .../211-python3-ufolib2_0.17.1+dfsg1-1_all.deb ... 205s Unpacking python3-ufolib2 (0.17.1+dfsg1-1) ... 205s Selecting previously unselected package python3-zopfli. 205s Preparing to unpack .../212-python3-zopfli_0.4.0-1_armhf.deb ... 205s Unpacking python3-zopfli (0.4.0-1) ... 205s Selecting previously unselected package unicode-data. 205s Preparing to unpack .../213-unicode-data_16.0.0-1_all.deb ... 205s Unpacking unicode-data (16.0.0-1) ... 205s Selecting previously unselected package python3-fonttools. 205s Preparing to unpack .../214-python3-fonttools_4.57.0-2build1_armhf.deb ... 205s Unpacking python3-fonttools (4.57.0-2build1) ... 206s Selecting previously unselected package python3-kiwisolver. 206s Preparing to unpack .../215-python3-kiwisolver_1.4.10~rc0-1_armhf.deb ... 206s Unpacking python3-kiwisolver (1.4.10~rc0-1) ... 206s Selecting previously unselected package python3-matplotlib. 206s Preparing to unpack .../216-python3-matplotlib_3.10.7+dfsg1-1_armhf.deb ... 206s Unpacking python3-matplotlib (3.10.7+dfsg1-1) ... 207s Selecting previously unselected package python3-pyproj. 207s Preparing to unpack .../217-python3-pyproj_3.7.2-1_armhf.deb ... 207s Unpacking python3-pyproj (3.7.2-1) ... 207s Selecting previously unselected package python3-pyshp. 207s Preparing to unpack .../218-python3-pyshp_2.3.1-3_all.deb ... 207s Unpacking python3-pyshp (2.3.1-3) ... 207s Selecting previously unselected package python3-shapely. 207s Preparing to unpack .../219-python3-shapely_2.1.2-1_armhf.deb ... 207s Unpacking python3-shapely (2.1.2-1) ... 207s Selecting previously unselected package python3-cartopy. 207s Preparing to unpack .../220-python3-cartopy_0.25.0+dfsg-1_armhf.deb ... 207s Unpacking python3-cartopy (0.25.0+dfsg-1) ... 207s Selecting previously unselected package python3-cftime. 207s Preparing to unpack .../221-python3-cftime_1.6.5-1_armhf.deb ... 207s Unpacking python3-cftime (1.6.5-1) ... 207s Selecting previously unselected package python3-click. 207s Preparing to unpack .../222-python3-click_8.2.0+0.really.8.1.8-1_all.deb ... 207s Unpacking python3-click (8.2.0+0.really.8.1.8-1) ... 207s Selecting previously unselected package python3-cloudpickle. 207s Preparing to unpack .../223-python3-cloudpickle_3.1.1-1_all.deb ... 207s Unpacking python3-cloudpickle (3.1.1-1) ... 207s Selecting previously unselected package python3-comm. 207s Preparing to unpack .../224-python3-comm_0.2.1-1_all.deb ... 207s Unpacking python3-comm (0.2.1-1) ... 207s Selecting previously unselected package python3-coverage. 207s Preparing to unpack .../225-python3-coverage_7.8.2+dfsg1-1_armhf.deb ... 207s Unpacking python3-coverage (7.8.2+dfsg1-1) ... 208s Selecting previously unselected package python3-crc32c. 208s Preparing to unpack .../226-python3-crc32c_2.7.1-1build1_armhf.deb ... 208s Unpacking python3-crc32c (2.7.1-1build1) ... 208s Selecting previously unselected package python3-fsspec. 208s Preparing to unpack .../227-python3-fsspec_2025.3.2-1ubuntu1_all.deb ... 208s Unpacking python3-fsspec (2025.3.2-1ubuntu1) ... 208s Selecting previously unselected package python3-toolz. 208s Preparing to unpack .../228-python3-toolz_1.0.0-2_all.deb ... 208s Unpacking python3-toolz (1.0.0-2) ... 208s Selecting previously unselected package python3-locket. 208s Preparing to unpack .../229-python3-locket_1.0.0-2_all.deb ... 208s Unpacking python3-locket (1.0.0-2) ... 208s Selecting previously unselected package python3-partd. 208s Preparing to unpack .../230-python3-partd_1.4.2-1_all.deb ... 208s Unpacking python3-partd (1.4.2-1) ... 208s Selecting previously unselected package python3-dask. 208s Preparing to unpack .../231-python3-dask_2024.12.1+dfsg-2_all.deb ... 208s Unpacking python3-dask (2024.12.1+dfsg-2) ... 208s Selecting previously unselected package python3-debugpy. 208s Preparing to unpack .../232-python3-debugpy_1.8.12+ds-1ubuntu1_armhf.deb ... 208s Unpacking python3-debugpy (1.8.12+ds-1ubuntu1) ... 208s Selecting previously unselected package python3.13-doc. 208s Preparing to unpack .../233-python3.13-doc_3.13.9-1_all.deb ... 208s Unpacking python3.13-doc (3.13.9-1) ... 209s Selecting previously unselected package python3-doc. 209s Preparing to unpack .../234-python3-doc_3.13.7-2_all.deb ... 209s Unpacking python3-doc (3.13.7-2) ... 209s Selecting previously unselected package python3-donfig. 209s Preparing to unpack .../235-python3-donfig_0.8.1+dfsg-3_all.deb ... 209s Unpacking python3-donfig (0.8.1+dfsg-3) ... 209s Selecting previously unselected package python3-execnet. 209s Preparing to unpack .../236-python3-execnet_2.1.1-1_all.deb ... 209s Unpacking python3-execnet (2.1.1-1) ... 209s Selecting previously unselected package python3-fastjsonschema. 209s Preparing to unpack .../237-python3-fastjsonschema_2.21.1-1_all.deb ... 209s Unpacking python3-fastjsonschema (2.21.1-1) ... 210s Selecting previously unselected package python3-flexcache. 210s Preparing to unpack .../238-python3-flexcache_0.3-2_all.deb ... 210s Unpacking python3-flexcache (0.3-2) ... 210s Selecting previously unselected package python3-flexparser. 210s Preparing to unpack .../239-python3-flexparser_0.4-1_all.deb ... 210s Unpacking python3-flexparser (0.4-1) ... 210s Selecting previously unselected package python3-h5py-serial. 210s Preparing to unpack .../240-python3-h5py-serial_3.13.0-1ubuntu1_armhf.deb ... 210s Unpacking python3-h5py-serial (3.13.0-1ubuntu1) ... 210s Selecting previously unselected package python3-h5py. 210s Preparing to unpack .../241-python3-h5py_3.13.0-1ubuntu1_all.deb ... 210s Unpacking python3-h5py (3.13.0-1ubuntu1) ... 210s Selecting previously unselected package python3-h5netcdf. 210s Preparing to unpack .../242-python3-h5netcdf_1.6.1-1_all.deb ... 210s Unpacking python3-h5netcdf (1.6.1-1) ... 210s Selecting previously unselected package python3-sortedcontainers. 210s Preparing to unpack .../243-python3-sortedcontainers_2.4.0-2_all.deb ... 210s Unpacking python3-sortedcontainers (2.4.0-2) ... 210s Selecting previously unselected package python3-hypothesis. 210s Preparing to unpack .../244-python3-hypothesis_6.130.5-2_all.deb ... 210s Unpacking python3-hypothesis (6.130.5-2) ... 210s Selecting previously unselected package python3-iniconfig. 210s Preparing to unpack .../245-python3-iniconfig_2.1.0-1_all.deb ... 210s Unpacking python3-iniconfig (2.1.0-1) ... 210s Selecting previously unselected package python3-jupyter-core. 210s Preparing to unpack .../246-python3-jupyter-core_5.7.2-5_all.deb ... 210s Unpacking python3-jupyter-core (5.7.2-5) ... 210s Selecting previously unselected package python3-tornado. 210s Preparing to unpack .../247-python3-tornado_6.5.2-3_armhf.deb ... 210s Unpacking python3-tornado (6.5.2-3) ... 210s Selecting previously unselected package python3-zmq. 210s Preparing to unpack .../248-python3-zmq_27.1.0-1_armhf.deb ... 210s Unpacking python3-zmq (27.1.0-1) ... 211s Selecting previously unselected package python3-jupyter-client. 211s Preparing to unpack .../249-python3-jupyter-client_8.6.3-3_all.deb ... 211s Unpacking python3-jupyter-client (8.6.3-3) ... 211s Selecting previously unselected package python3-nest-asyncio. 211s Preparing to unpack .../250-python3-nest-asyncio_1.5.4-1_all.deb ... 211s Unpacking python3-nest-asyncio (1.5.4-1) ... 211s Selecting previously unselected package python3-ipykernel. 211s Preparing to unpack .../251-python3-ipykernel_6.29.5-2_all.deb ... 211s Unpacking python3-ipykernel (6.29.5-2) ... 211s Selecting previously unselected package python3-jupyter-console. 211s Preparing to unpack .../252-python3-jupyter-console_6.6.3-2_all.deb ... 211s Unpacking python3-jupyter-console (6.6.3-2) ... 211s Selecting previously unselected package python3-jupyterlab-pygments. 211s Preparing to unpack .../253-python3-jupyterlab-pygments_0.2.2-3_all.deb ... 211s Unpacking python3-jupyterlab-pygments (0.2.2-3) ... 211s Selecting previously unselected package python3-mistune. 211s Preparing to unpack .../254-python3-mistune_3.1.4-1_all.deb ... 211s Unpacking python3-mistune (3.1.4-1) ... 211s Selecting previously unselected package python3-nbformat. 211s Preparing to unpack .../255-python3-nbformat_5.9.1-1_all.deb ... 211s Unpacking python3-nbformat (5.9.1-1) ... 211s Selecting previously unselected package python3-nbclient. 211s Preparing to unpack .../256-python3-nbclient_0.8.0-2_all.deb ... 211s Unpacking python3-nbclient (0.8.0-2) ... 211s Selecting previously unselected package python3-tinycss2. 211s Preparing to unpack .../257-python3-tinycss2_1.4.0-2_all.deb ... 211s Unpacking python3-tinycss2 (1.4.0-2) ... 211s Selecting previously unselected package python3-pandocfilters. 211s Preparing to unpack .../258-python3-pandocfilters_1.5.1-1_all.deb ... 211s Unpacking python3-pandocfilters (1.5.1-1) ... 211s Selecting previously unselected package python3-nbconvert. 211s Preparing to unpack .../259-python3-nbconvert_7.16.6-1_all.deb ... 211s Unpacking python3-nbconvert (7.16.6-1) ... 211s Selecting previously unselected package python3-nbsphinx. 211s Preparing to unpack .../260-python3-nbsphinx_0.9.5+ds-1_all.deb ... 211s Unpacking python3-nbsphinx (0.9.5+ds-1) ... 211s Selecting previously unselected package python3-netcdf4. 211s Preparing to unpack .../261-python3-netcdf4_1.7.2-1build4_armhf.deb ... 211s Unpacking python3-netcdf4 (1.7.2-1build4) ... 212s Selecting previously unselected package python3-pydata-sphinx-theme. 212s Preparing to unpack .../262-python3-pydata-sphinx-theme_0.16.1+dfsg-3_all.deb ... 212s Unpacking python3-pydata-sphinx-theme (0.16.1+dfsg-3) ... 212s Selecting previously unselected package python3-numcodecs. 212s Preparing to unpack .../263-python3-numcodecs_0.16.3+ds-1_armhf.deb ... 212s Unpacking python3-numcodecs (0.16.3+ds-1) ... 212s Selecting previously unselected package python3-numpydoc. 212s Preparing to unpack .../264-python3-numpydoc_1.9.0-1_all.deb ... 212s Unpacking python3-numpydoc (1.9.0-1) ... 212s Selecting previously unselected package python3-pytz. 212s Preparing to unpack .../265-python3-pytz_2025.2-4_all.deb ... 212s Unpacking python3-pytz (2025.2-4) ... 212s Selecting previously unselected package python3-pandas-lib:armhf. 212s Preparing to unpack .../266-python3-pandas-lib_2.3.3+dfsg-1ubuntu1_armhf.deb ... 212s Unpacking python3-pandas-lib:armhf (2.3.3+dfsg-1ubuntu1) ... 212s Selecting previously unselected package python3-pandas. 212s Preparing to unpack .../267-python3-pandas_2.3.3+dfsg-1ubuntu1_all.deb ... 212s Unpacking python3-pandas (2.3.3+dfsg-1ubuntu1) ... 213s Selecting previously unselected package python3-pickleshare. 213s Preparing to unpack .../268-python3-pickleshare_0.7.5-5_all.deb ... 213s Unpacking python3-pickleshare (0.7.5-5) ... 213s Selecting previously unselected package python3-pint. 213s Preparing to unpack .../269-python3-pint_0.24.4-2_all.deb ... 213s Unpacking python3-pint (0.24.4-2) ... 213s Selecting previously unselected package python3-pip. 213s Preparing to unpack .../270-python3-pip_25.1.1+dfsg-1ubuntu2_all.deb ... 213s Unpacking python3-pip (25.1.1+dfsg-1ubuntu2) ... 213s Selecting previously unselected package python3-pluggy. 213s Preparing to unpack .../271-python3-pluggy_1.6.0-1_all.deb ... 213s Unpacking python3-pluggy (1.6.0-1) ... 214s Selecting previously unselected package python3-pooch. 214s Preparing to unpack .../272-python3-pooch_1.8.2-1_all.deb ... 214s Unpacking python3-pooch (1.8.2-1) ... 214s Selecting previously unselected package python3-pytest. 214s Preparing to unpack .../273-python3-pytest_8.3.5-2_all.deb ... 214s Unpacking python3-pytest (8.3.5-2) ... 214s Selecting previously unselected package python3-regex. 214s Preparing to unpack .../274-python3-regex_0.1.20250918-1_armhf.deb ... 214s Unpacking python3-regex (0.1.20250918-1) ... 214s Selecting previously unselected package python3-tomlkit. 214s Preparing to unpack .../275-python3-tomlkit_0.13.3-2_all.deb ... 214s Unpacking python3-tomlkit (0.13.3-2) ... 214s Selecting previously unselected package python3-pytest-mypy. 214s Preparing to unpack .../276-python3-pytest-mypy_3.2.0-2_all.deb ... 214s Unpacking python3-pytest-mypy (3.2.0-2) ... 214s Selecting previously unselected package python3-pytest-xdist. 214s Preparing to unpack .../277-python3-pytest-xdist_3.8.0-2_all.deb ... 214s Unpacking python3-pytest-xdist (3.8.0-2) ... 214s Selecting previously unselected package python3-seaborn. 214s Preparing to unpack .../278-python3-seaborn_0.13.2-5_all.deb ... 214s Unpacking python3-seaborn (0.13.2-5) ... 214s Selecting previously unselected package python3-setuptools-scm. 214s Preparing to unpack .../279-python3-setuptools-scm_8.2.1-3_all.deb ... 214s Unpacking python3-setuptools-scm (8.2.1-3) ... 214s Selecting previously unselected package python3-sphinx-book-theme. 214s Preparing to unpack .../280-python3-sphinx-book-theme_1.1.4-2_all.deb ... 214s Unpacking python3-sphinx-book-theme (1.1.4-2) ... 214s Selecting previously unselected package python3-sphinx-copybutton. 214s Preparing to unpack .../281-python3-sphinx-copybutton_0.5.2-3_all.deb ... 214s Unpacking python3-sphinx-copybutton (0.5.2-3) ... 214s Selecting previously unselected package python3-sphinx-design. 214s Preparing to unpack .../282-python3-sphinx-design_0.6.1-2_all.deb ... 214s Unpacking python3-sphinx-design (0.6.1-2) ... 215s Selecting previously unselected package python3-sphinx-gallery. 215s Preparing to unpack .../283-python3-sphinx-gallery_0.17.1-1_all.deb ... 215s Unpacking python3-sphinx-gallery (0.17.1-1) ... 215s Selecting previously unselected package python3-sphinx-inline-tabs. 215s Preparing to unpack .../284-python3-sphinx-inline-tabs_2023.4.21-3_all.deb ... 215s Unpacking python3-sphinx-inline-tabs (2023.4.21-3) ... 215s Selecting previously unselected package python3-sphinx-remove-toctrees. 215s Preparing to unpack .../285-python3-sphinx-remove-toctrees_1.0.0-1_all.deb ... 215s Unpacking python3-sphinx-remove-toctrees (1.0.0-1) ... 215s Selecting previously unselected package sphinx-rtd-theme-common. 215s Preparing to unpack .../286-sphinx-rtd-theme-common_3.0.2+dfsg-3_all.deb ... 215s Unpacking sphinx-rtd-theme-common (3.0.2+dfsg-3) ... 215s Selecting previously unselected package python3-sphinxcontrib.jquery. 215s Preparing to unpack .../287-python3-sphinxcontrib.jquery_4.1-6_all.deb ... 215s Unpacking python3-sphinxcontrib.jquery (4.1-6) ... 215s Selecting previously unselected package python3-sphinx-rtd-theme. 215s Preparing to unpack .../288-python3-sphinx-rtd-theme_3.0.2+dfsg-3_all.deb ... 215s Unpacking python3-sphinx-rtd-theme (3.0.2+dfsg-3) ... 215s Selecting previously unselected package python3-sphinxcontrib-mermaid. 215s Preparing to unpack .../289-python3-sphinxcontrib-mermaid_1.0.0-1_all.deb ... 215s Unpacking python3-sphinxcontrib-mermaid (1.0.0-1) ... 215s Selecting previously unselected package python3-sphinxext-opengraph. 215s Preparing to unpack .../290-python3-sphinxext-opengraph_0.12.0-1_all.deb ... 215s Unpacking python3-sphinxext-opengraph (0.12.0-1) ... 215s Selecting previously unselected package python3-sphinxext-rediraffe. 215s Preparing to unpack .../291-python3-sphinxext-rediraffe_0.3.0-1_all.deb ... 215s Unpacking python3-sphinxext-rediraffe (0.3.0-1) ... 215s Selecting previously unselected package python3-xarray. 216s Preparing to unpack .../292-python3-xarray_2025.03.1-8_all.deb ... 216s Unpacking python3-xarray (2025.03.1-8) ... 216s Selecting previously unselected package python3-zarr. 216s Preparing to unpack .../293-python3-zarr_3.1.3-1_all.deb ... 216s Unpacking python3-zarr (3.1.3-1) ... 216s Selecting previously unselected package tzdata-legacy. 216s Preparing to unpack .../294-tzdata-legacy_2025b-5ubuntu1_all.deb ... 216s Unpacking tzdata-legacy (2025b-5ubuntu1) ... 216s Selecting previously unselected package python-hypothesis-doc. 216s Preparing to unpack .../295-python-hypothesis-doc_6.130.5-2_all.deb ... 216s Unpacking python-hypothesis-doc (6.130.5-2) ... 216s Selecting previously unselected package python-scipy-doc. 216s Preparing to unpack .../296-python-scipy-doc_1.15.3-1ubuntu1_all.deb ... 216s Unpacking python-scipy-doc (1.15.3-1ubuntu1) ... 217s Setting up libpython3.13:armhf (3.13.9-1) ... 217s Setting up dh-python (6.20250414) ... 217s Setting up libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 217s Setting up liblcms2-2:armhf (2.17-1) ... 217s Setting up python3-iniconfig (2.1.0-1) ... 217s Setting up python3-tornado (6.5.2-3) ... 219s Setting up libnorm1t64:armhf (1.5.9+dfsg-4) ... 219s Setting up libsharpyuv0:armhf (1.5.0-0.1) ... 219s Setting up python3-pure-eval (0.2.3-1) ... 219s Setting up node-lru-cache (10.0.1-3) ... 219s Setting up fonts-lato (2.015-1) ... 219s Setting up libjs-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 219s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 219s Setting up libsodium23:armhf (1.0.18-1build3) ... 219s Setting up liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 219s Setting up proj-data (9.7.0-1) ... 219s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 219s Setting up libxrender1:armhf (1:0.9.12-1) ... 219s Setting up libdebuginfod-common (0.194-1) ... 219s Setting up python3-parso (0.8.5-1) ... 220s Setting up libgeos3.13.1:armhf (3.13.1-1) ... 220s Setting up python3-lz4 (4.4.4+dfsg-3) ... 220s Setting up python3-defusedxml (0.7.1-3) ... 220s Setting up libarchive-zip-perl (1.68-1) ... 220s Setting up python3-asttokens (3.0.0-2) ... 221s Setting up python3-alabaster (0.7.16-0.1) ... 221s Setting up libgeos-c1t64:armhf (3.13.1-1) ... 221s Setting up fonts-lyx (2.4.4-2) ... 221s Setting up python3-mypy-extensions (1.1.0-1) ... 221s Setting up libdebhelper-perl (13.24.2ubuntu1) ... 221s Setting up python3-fsspec (2025.3.2-1ubuntu1) ... 222s Setting up libpython3.14-minimal:armhf (3.14.0-4) ... 222s Setting up x11-common (1:7.7+24ubuntu1) ... 223s Setting up libdeflate0:armhf (1.23-2) ... 223s Setting up linux-libc-dev:armhf (6.17.0-5.5) ... 223s Setting up m4 (1.4.20-2) ... 223s Setting up libqhull-r8.0:armhf (2020.2-7) ... 223s Setting up python3-coverage (7.8.2+dfsg1-1) ... 224s Setting up python3-pyshp (2.3.1-3) ... 224s Setting up node-cjs-module-lexer (1.2.3+dfsg-1) ... 224s Setting up python3-pytz (2025.2-4) ... 224s Setting up python3-sortedcontainers (2.4.0-2) ... 225s Setting up node-fortawesome-fontawesome-free (6.7.2+ds1-1) ... 225s Setting up python3-pandocfilters (1.5.1-1) ... 225s Setting up libgomp1:armhf (15.2.0-7ubuntu1) ... 225s Setting up python3-click (8.2.0+0.really.8.1.8-1) ... 225s Setting up libjs-requirejs (2.3.7+ds+~2.1.37-1) ... 225s Setting up fonts-open-sans (1.11-2) ... 225s Setting up python3-wheel (0.46.1-2) ... 226s Setting up libjbig0:armhf (2.1-6.1ubuntu2) ... 226s Setting up python3-webencodings (0.5.1-5) ... 226s Setting up python3-setuptools-scm (8.2.1-3) ... 226s Setting up libaec0:armhf (1.1.4-2) ... 226s Setting up python3-platformdirs (4.3.7-1) ... 227s Setting up python3-psutil (7.1.0-1ubuntu1) ... 228s Setting up libsource-highlight-common (3.1.9-4.3build1) ... 228s Setting up tzdata-legacy (2025b-5ubuntu1) ... 228s Setting up python3-cloudpickle (3.1.1-1) ... 228s Setting up libsnappy1v5:armhf (1.2.2-2) ... 228s Setting up libc6-dbg:armhf (2.42-2ubuntu2) ... 228s Setting up libdw1t64:armhf (0.194-1) ... 228s Setting up python3-fs (2.4.16-9ubuntu1) ... 228s Setting up unicode-data (16.0.0-1) ... 228s Setting up python3-jupyterlab-pygments (0.2.2-3) ... 229s Setting up python3-roman (5.1-1) ... 229s Setting up libpgm-5.3-0t64:armhf (5.3.128~dfsg-2.1build1) ... 229s Setting up python3-decorator (5.2.1-2) ... 229s Setting up autotools-dev (20240727.1) ... 229s Setting up libblas3:armhf (3.12.1-7) ... 229s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3 to provide /usr/lib/arm-linux-gnueabihf/libblas.so.3 (libblas.so.3-arm-linux-gnueabihf) in auto mode 229s Setting up rpcsvc-proto (1.4.3-1) ... 229s Setting up python3-flexparser (0.4-1) ... 230s Setting up python3-wcwidth (0.2.13+dfsg1-1) ... 230s Setting up python3-pyproject-hooks (1.2.0-1) ... 231s Setting up node-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 231s Setting up libzopfli1 (1.0.3-3) ... 231s Setting up libfreetype6:armhf (2.13.3+dfsg-1build1) ... 231s Setting up python3-accessible-pygments (0.0.5-2) ... 231s Setting up python3-typeshed (0.0~git20241223.ea91db2-4) ... 231s Setting up python3-executing (2.2.0-0.2) ... 231s Setting up python3-snowballstemmer (3.0.1-1) ... 232s Setting up node-balanced-match (2.0.0-1) ... 232s Setting up python-cartopy-data (0.25.0+dfsg-1) ... 232s Setting up python3-pooch (1.8.2-1) ... 233s Setting up node-brace-expansion (2.0.1+~1.1.0-2) ... 233s Setting up python3-nest-asyncio (1.5.4-1) ... 233s Setting up python3-brotli (1.1.0-2build6) ... 233s Setting up liblzf1:armhf (3.6-4) ... 233s Setting up python3-cycler (0.12.1-2) ... 233s Setting up libimagequant0:armhf (2.18.0-1build1) ... 233s Setting up fonts-dejavu-mono (2.37-8) ... 233s Setting up python3-kiwisolver (1.4.10~rc0-1) ... 234s Setting up libcares2:armhf (1.34.5-1) ... 234s Setting up libmpc3:armhf (1.3.1-2) ... 234s Setting up python3-numpy-dev:armhf (1:2.3.4+ds-3ubuntu1) ... 234s Setting up python3-mypy (1.15.0-5) ... 238s Setting up libtcl8.6:armhf (8.6.17+dfsg-1) ... 238s Setting up autopoint (0.23.2-1) ... 238s Setting up fonts-dejavu-core (2.37-8) ... 238s Setting up python3-pip (25.1.1+dfsg-1ubuntu2) ... 241s Setting up libjpeg-turbo8:armhf (2.1.5-4ubuntu2) ... 241s Setting up python3-regex (0.1.20250918-1) ... 241s Setting up python3-html5lib (1.2-2) ... 242s Setting up libbabeltrace1:armhf (1.5.11-4build3) ... 242s Setting up python3-pickleshare (0.7.5-5) ... 242s Setting up python3-crc32c (2.7.1-1build1) ... 243s Setting up python3-installer (0.7.0+dfsg1-3) ... 243s Setting up libgfortran5:armhf (15.2.0-7ubuntu1) ... 243s Setting up autoconf (2.72-3.1ubuntu1) ... 243s Setting up python3-pluggy (1.6.0-1) ... 243s Setting up libwebp7:armhf (1.5.0-0.1) ... 243s Setting up libubsan1:armhf (15.2.0-7ubuntu1) ... 243s Setting up python3-fastjsonschema (2.21.1-1) ... 244s Setting up dwz (0.16-2) ... 244s Setting up libcrypt-dev:armhf (1:4.4.38-1build1) ... 244s Setting up python3-traitlets (5.14.3+really5.14.3-1) ... 244s Setting up libasan8:armhf (15.2.0-7ubuntu1) ... 244s Setting up python-tinycss2-common (1.4.0-2) ... 244s Setting up libjson-perl (4.10000-1) ... 244s Setting up libxslt1.1:armhf (1.1.43-0.3) ... 244s Setting up libblosc1:armhf (1.21.5+ds-2) ... 244s Setting up debugedit (1:5.2-3) ... 244s Setting up mypy (1.15.0-5) ... 244s Setting up liblua5.4-0:armhf (5.4.8-1) ... 244s Setting up libopenjp2-7:armhf (2.5.3-2.1) ... 244s Setting up python3-toolz (1.0.0-2) ... 245s Setting up libharfbuzz0b:armhf (12.1.0-1) ... 245s Setting up python3-flexcache (0.3-2) ... 245s Setting up sgml-base (1.31+nmu1) ... 245s Setting up python3-donfig (0.8.1+dfsg-3) ... 245s Setting up libxss1:armhf (1:1.2.3-1build3) ... 245s Setting up node-minimatch (9.0.3-6) ... 245s Setting up pandoc-data (3.1.11.1-3build1) ... 245s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 245s Setting up python3-mpmath (1.3.0-2) ... 247s Setting up node-xtend (4.0.2-3) ... 247s Setting up libisl23:armhf (0.27-1) ... 247s Setting up python3-build (1.2.2-4) ... 247s Setting up libc-dev-bin (2.42-2ubuntu2) ... 247s Setting up python3-execnet (2.1.1-1) ... 247s Setting up python-matplotlib-data (3.10.7+dfsg1-1) ... 247s Setting up python3-tomlkit (0.13.3-2) ... 248s Setting up libwebpmux3:armhf (1.5.0-0.1) ... 248s Setting up python3-locket (1.0.0-2) ... 248s Setting up cpp-15-arm-linux-gnueabihf (15.2.0-7ubuntu1) ... 248s Setting up python3-mistune (3.1.4-1) ... 249s Setting up python3-stack-data (0.6.3-1) ... 249s Setting up python3-soupsieve (2.7-2) ... 249s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 249s Setting up sphinx-rtd-theme-common (3.0.2+dfsg-3) ... 249s Setting up python3.14-minimal (3.14.0-4) ... 251s Setting up libcc1-0:armhf (15.2.0-7ubuntu1) ... 251s Setting up python3-jupyter-core (5.7.2-5) ... 251s Setting up cpp-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 251s Setting up libsz2:armhf (1.1.4-2) ... 251s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 251s Setting up python3-imagesize (1.4.1-1) ... 252s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 252s Setting up automake (1:1.18.1-2) ... 252s update-alternatives: using /usr/bin/automake-1.18 to provide /usr/bin/automake (automake) in auto mode 252s Setting up python3-prompt-toolkit (3.0.52-1) ... 253s Setting up libfile-stripnondeterminism-perl (1.15.0-1) ... 253s Setting up python3-partd (1.4.2-1) ... 253s Setting up python3-sympy (1.14.0-2) ... 263s /usr/lib/python3/dist-packages/sympy/testing/runtests.py:283: SyntaxWarning: 'return' in a 'finally' block 263s return p.returncode 272s Setting up libdebuginfod1t64:armhf (0.194-1) ... 272s Setting up liblapack3:armhf (3.12.1-7) ... 272s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3 to provide /usr/lib/arm-linux-gnueabihf/liblapack.so.3 (liblapack.so.3-arm-linux-gnueabihf) in auto mode 272s Setting up gettext (0.23.2-1) ... 272s Setting up python3-tinycss2 (1.4.0-2) ... 272s Setting up libgcc-15-dev:armhf (15.2.0-7ubuntu1) ... 272s Setting up libzmq5:armhf (4.3.5-1build2) ... 272s Setting up gcc-15-arm-linux-gnueabihf (15.2.0-7ubuntu1) ... 272s Setting up python3-jedi (0.19.1+ds1-1) ... 273s Setting up libpython3.14-stdlib:armhf (3.14.0-4) ... 273s Setting up pybuild-plugin-pyproject (6.20250414) ... 273s Setting up fontconfig-config (2.15.0-2.3ubuntu1) ... 274s Setting up python3-pytest (8.3.5-2) ... 275s Setting up libwebpdemux2:armhf (1.5.0-0.1) ... 275s Setting up python3-hypothesis (6.130.5-2) ... 276s Setting up python3-dask (2024.12.1+dfsg-2) ... 280s Setting up libsource-highlight4t64:armhf (3.1.9-4.3build1) ... 280s Setting up python3-nbformat (5.9.1-1) ... 280s Setting up python3-bs4 (4.13.4-3) ... 281s Setting up python3-zopfli (0.4.0-1) ... 281s Setting up intltool-debian (0.35.0+20060710.6) ... 281s Setting up python3-bleach (6.2.0-1) ... 282s Setting up python3-matplotlib-inline (0.1.7-1) ... 282s Setting up python3-comm (0.2.1-1) ... 282s Setting up python3-pint (0.24.4-2) ... 283s Setting up python3.13-doc (3.13.9-1) ... 283s Setting up gdb (16.3-1ubuntu2) ... 283s Setting up pandoc (3.1.11.1+ds-4) ... 283s Setting up python3-ipython (8.35.0-2) ... 284s /usr/lib/python3/dist-packages/IPython/core/interactiveshell.py:3141: SyntaxWarning: 'return' in a 'finally' block 284s return result 285s Setting up python3-zmq (27.1.0-1) ... 286s Setting up libraqm0:armhf (0.10.3-1) ... 286s Setting up python-scipy-doc (1.15.3-1ubuntu1) ... 286s Setting up python3-numpy (1:2.3.4+ds-3ubuntu1) ... 291s Setting up libjs-sphinxdoc (8.2.3-1ubuntu2) ... 291s Setting up dh-strip-nondeterminism (1.15.0-1) ... 291s Setting up libhdf5-310:armhf (1.14.5+repack-4) ... 291s Setting up cpp-15 (15.2.0-7ubuntu1) ... 291s Setting up python3-lxml:armhf (6.0.2-1) ... 292s Setting up libtiff6:armhf (4.7.0-3ubuntu3) ... 292s Setting up cpp (4:15.2.0-4ubuntu1) ... 292s Setting up xml-core (0.19) ... 292s Setting up python3-pytest-mypy (3.2.0-2) ... 293s Setting up libc6-dev:armhf (2.42-2ubuntu2) ... 293s Setting up python3-jupyter-client (8.6.3-3) ... 293s Setting up python3-contourpy (1.3.1-2) ... 293s Setting up ipython3 (8.35.0-2) ... 293s Setting up libfontconfig1:armhf (2.15.0-2.3ubuntu1) ... 293s Setting up python3.14 (3.14.0-4) ... 295s Setting up python3-doc (3.13.7-2) ... 295s Setting up gcc-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 295s Setting up libhdf5-hl-310:armhf (1.14.5+repack-4) ... 295s Setting up python3-shapely (2.1.2-1) ... 297s Setting up libxft2:armhf (2.3.6-1build1) ... 297s Setting up python-xarray-doc (2025.03.1-8) ... 297s Setting up python3-scipy (1.15.3-1ubuntu1) ... 299s /usr/lib/python3/dist-packages/scipy/optimize/_optimize.py:921: SyntaxWarning: 'break' in a 'finally' block 299s break 307s Setting up python3-pytest-xdist (3.8.0-2) ... 308s Setting up python-hypothesis-doc (6.130.5-2) ... 308s Setting up libproj25:armhf (9.7.0-1) ... 308s Setting up python-pandas-doc (2.3.3+dfsg-1ubuntu1) ... 308s Setting up po-debconf (1.0.21+nmu1) ... 308s Setting up libtk8.6:armhf (8.6.17-1) ... 308s Setting up python3-pandas-lib:armhf (2.3.3+dfsg-1ubuntu1) ... 308s Setting up libnetcdf22:armhf (1:4.9.3-1build1) ... 308s Setting up python3-h5py-serial (3.13.0-1ubuntu1) ... 309s Setting up python3-all (3.13.7-2) ... 309s Setting up python3-debugpy (1.8.12+ds-1ubuntu1) ... 310s Setting up python3-pyproj (3.7.2-1) ... 311s Setting up python3.13-tk (3.13.9-1) ... 311s Setting up python3-nbclient (0.8.0-2) ... 311s Setting up python3-pil:armhf (11.3.0-1ubuntu2) ... 312s Setting up gcc-15 (15.2.0-7ubuntu1) ... 312s Setting up libstdc++-15-dev:armhf (15.2.0-7ubuntu1) ... 312s Setting up python3-pandas (2.3.3+dfsg-1ubuntu1) ... 328s Setting up sphinx-common (8.2.3-1ubuntu2) ... 328s Setting up python3-ipykernel (6.29.5-2) ... 328s Setting up python3-h5py (3.13.0-1ubuntu1) ... 329s Setting up python3-bottleneck (1.4.2+ds1-2build2) ... 329s Setting up python3-cftime (1.6.5-1) ... 329s Setting up python3-nbconvert (7.16.6-1) ... 330s Setting up python3-netcdf4 (1.7.2-1build4) ... 330s Setting up tk8.6-blt2.5 (2.5.3+dfsg-8) ... 330s Setting up python3.14-tk (3.14.0-4) ... 331s Setting up libtool (2.5.4-7) ... 331s Setting up blt (2.5.3+dfsg-8) ... 331s Setting up python3-xarray (2025.03.1-8) ... 335s Setting up g++-15-arm-linux-gnueabihf (15.2.0-7ubuntu1) ... 335s Setting up python3-tk:armhf (3.13.9-1) ... 335s Setting up python3-jupyter-console (6.6.3-2) ... 335s Setting up gcc (4:15.2.0-4ubuntu1) ... 335s Setting up dh-autoreconf (21) ... 335s Setting up python3-h5netcdf (1.6.1-1) ... 336s Setting up python3-pil.imagetk:armhf (11.3.0-1ubuntu2) ... 336s Setting up g++-15 (15.2.0-7ubuntu1) ... 336s Setting up g++-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 336s Setting up debhelper (13.24.2ubuntu1) ... 336s Setting up g++ (4:15.2.0-4ubuntu1) ... 336s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 336s Setting up build-essential (12.12ubuntu1) ... 336s Setting up pybuild-plugin-autopkgtest (6.20250414) ... 336s Setting up python3-fonttools (4.57.0-2build1) ... 339s Setting up python3-ufolib2 (0.17.1+dfsg1-1) ... 339s Setting up node-acorn (8.8.1+ds+~cs25.17.7-2) ... 339s Setting up node-ms (2.1.3+~cs0.7.31-3) ... 339s Setting up node-semver (7.6.1+~7.5.8-2) ... 339s Setting up node-corepack (0.24.0-5) ... 339s Setting up python3-matplotlib (3.10.7+dfsg1-1) ... 344s Setting up python3-cartopy (0.25.0+dfsg-1) ... 345s Setting up python3-seaborn (0.13.2-5) ... 346s Setting up node-debug (4.4.1+~4.1.12-1) ... 346s Setting up node-llhttp (9.3.3~really9.3.0+~cs12.11.8-3) ... 346s Setting up node-undici (7.16.0+dfsg+~cs3.2.0-2) ... 346s Setting up libnode115:armhf (20.19.4+dfsg-1) ... 346s Setting up nodejs (20.19.4+dfsg-1) ... 346s update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode 346s Setting up node-argparse (2.0.1-2) ... 346s Setting up node-esprima (4.0.1+ds+~4.0.3-2) ... 346s Setting up node-js-yaml (4.1.0+dfsg+~4.0.5-7) ... 346s Setting up python-dask-doc (2024.12.1+dfsg-2) ... 346s Processing triggers for install-info (7.2-5) ... 347s Processing triggers for libc-bin (2.42-2ubuntu2) ... 347s Processing triggers for systemd (257.9-0ubuntu2) ... 347s Processing triggers for man-db (2.13.1-1) ... 349s Processing triggers for sgml-base (1.31+nmu1) ... 349s Setting up docutils-common (0.21.2+dfsg-2) ... 349s Processing triggers for sgml-base (1.31+nmu1) ... 349s Setting up python3-docutils (0.21.2+dfsg-2) ... 350s Setting up python3-sphinx (8.2.3-1ubuntu2) ... 353s Setting up python3-sphinx-gallery (0.17.1-1) ... 353s Setting up python3-sphinx-copybutton (0.5.2-3) ... 354s Setting up python3-sphinx-design (0.6.1-2) ... 354s Setting up python3-nbsphinx (0.9.5+ds-1) ... 354s Setting up python3-sphinxext-rediraffe (0.3.0-1) ... 355s Setting up python3-sphinxcontrib-mermaid (1.0.0-1) ... 355s Setting up python3-sphinxcontrib.jquery (4.1-6) ... 355s Setting up python3-numpydoc (1.9.0-1) ... 356s Setting up python3-pydata-sphinx-theme (0.16.1+dfsg-3) ... 356s Setting up python3-sphinxext-opengraph (0.12.0-1) ... 356s Setting up python3-autodocsumm (0.2.14-2) ... 357s Setting up python3-sphinx-remove-toctrees (1.0.0-1) ... 357s Setting up python3-sphinx-inline-tabs (2023.4.21-3) ... 357s Setting up python3-sphinx-book-theme (1.1.4-2) ... 358s Setting up python3-sphinx-rtd-theme (3.0.2+dfsg-3) ... 358s Setting up python3-numcodecs (0.16.3+ds-1) ... 358s Setting up python3-zarr (3.1.3-1) ... 369s autopkgtest [10:31:37]: test pybuild-autopkgtest: pybuild-autopkgtest 369s autopkgtest [10:31:37]: test pybuild-autopkgtest: [----------------------- 371s pybuild-autopkgtest 372s I: pybuild base:311: cd /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build; python3.14 -m pytest --deselect=tests/test_cftimeindex.py::test_asi8 --deselect=tests/test_datatree.py::TestRepr::test_doc_example --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 --deselect=tests/test_strategies.py::TestReduction::test_mean 388s ============================= test session starts ============================== 388s platform linux -- Python 3.14.0, pytest-8.3.5, pluggy-1.6.0 388s rootdir: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build 388s configfile: pyproject.toml 388s plugins: typeguard-4.4.2, hypothesis-6.130.5, mypy-plugins-3.2.0, xdist-3.8.0, zarr-3.1.3 388s collected 21888 items / 62 deselected / 4 skipped / 21826 selected 388s 389s tests/test_accessor_dt.py .............................................. [ 0%] 391s ........................................................................ [ 0%] 391s ........................................................................ [ 0%] 394s ........................................................................ [ 1%] 397s ........................................................................ [ 1%] 397s .................... [ 1%] 397s tests/test_accessor_str.py ............................................. [ 1%] 398s ........................................................................ [ 2%] 398s ........................................................................ [ 2%] 398s ...................................... [ 2%] 399s tests/test_assertions.py .............................. [ 2%] 399s tests/test_backends.py .ssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 399s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 399s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 404s ssssssssssssssssssssssss.................s...............XxXsXsssss..... [ 4%] 415s ..s..................Fs........s.s.................ss................... [ 4%] 429s ..........................................................s............. [ 4%] 444s ..XxXsXsssss.......s..................Fs........s.s.................ss.. [ 5%] 458s ........................................................................ [ 5%] 472s ...s...............XxXsXsssss.......s..................Fs........s.s.... [ 5%] 484s .............ss......................................................... [ 5%] 500s .....FFF.......s..............FFFFF...F.....Fs....FFFFFFFFF..xxxsxsssssF [ 6%] 521s FFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ssFFFFFFFFFFFFFFFFF [ 6%] 546s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF...F.....Fs....FFFFF [ 6%] 567s FFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ss [ 7%] 596s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF... [ 7%] 620s F.....Fs....FFFFFFFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss. [ 7%] 652s FFFF...F....F..ssFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.F [ 8%] 668s F.FFF...FFFFFFFFFF.s..FF.F.F.FFFFFs..................s...............XxX [ 8%] 672s sXXxXsX.......s.s................................s...............XxXsXXx [ 8%] 675s XsX.......s.s...............ss.................s...............XxXsXXxXs [ 9%] 675s X.......s.s................F.sssssssssssssssssssssssssssssssssssssssssss [ 9%] 676s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 9%] 693s sssssssssssssssssssssss.FFFFFFFFFFFFFFFsFFFFFFFFFFFFF.FxxxsxxxxsxFFFFFFF [ 10%] 698s sFs.FFFFFFFFFFF.FF...Fssssssssssssssssssssssssssssssssssssssssssssssssss [ 10%] 698s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 10%] 698s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 699s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 699s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 699s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssFF [ 12%] 708s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFssssssssssssssssssssssssssssssssss [ 12%] 713s sssssssssssssssssssssssssssssssss.sxsFFFF.F.s..s..s..s.sss.FFsFFFFFFFFFF [ 12%] 729s FFFFFFFFFFFFFFFFFFFFFFxxxFFFFFFFFFFFFFFFFFFFF....ssFFFFFFFFFFFFs.sssssss [ 13%] 729s s [ 13%] 730s tests/test_backends_api.py s....................... [ 13%] 730s tests/test_backends_common.py ... [ 13%] 734s tests/test_backends_datatree.py sssssssssssssssss.F.FFF.F.......F.F.F.F. [ 13%] 736s F.F.F.F...... [ 13%] 741s tests/test_backends_file_manager.py ............................... [ 13%] 741s tests/test_backends_locks.py . [ 13%] 741s tests/test_backends_lru_cache.py ........ [ 13%] 745s tests/test_calendar_ops.py ........................... [ 13%] 745s tests/test_cftime_offsets.py ........................................... [ 14%] 745s ........................................................................ [ 14%] 745s ........................................................................ [ 14%] 745s ........................................................................ [ 15%] 746s ........................................................................ [ 15%] 746s ........................................................................ [ 15%] 746s ........................................................................ [ 16%] 746s ........................................................................ [ 16%] 746s ........................................................................ [ 16%] 746s ........................................................................ [ 17%] 746s ........................................................................ [ 17%] 746s ........................................................................ [ 17%] 746s ........................................................................ [ 18%] 746s ........................................................................ [ 18%] 746s ........................................................................ [ 18%] 746s ........................................................................ [ 19%] 747s ........................................................................ [ 19%] 747s ........................................................................ [ 19%] 747s ........................................................................ [ 20%] 747s ........................................................................ [ 20%] 747s ........................................................................ [ 20%] 747s ........................................................................ [ 21%] 747s ........................................................................ [ 21%] 747s ........................................................................ [ 21%] 747s ........................................................................ [ 22%] 747s ........................................................................ [ 22%] 748s ........................................................................ [ 22%] 748s ........................................................................ [ 23%] 748s ........................................................................ [ 23%] 748s ........................................................................ [ 23%] 748s ........................................................................ [ 24%] 748s ........................................................................ [ 24%] 748s ........................................................................ [ 24%] 748s ........................................................................ [ 25%] 748s ........................................................................ [ 25%] 748s ........................................................................ [ 25%] 749s ........................................................................ [ 26%] 749s ........................................................................ [ 26%] 749s ........................................................................ [ 26%] 749s .............ssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 26%] 749s .ssss....ssss....ssss....ssss.................................. [ 27%] 749s tests/test_cftimeindex.py .............................................. [ 27%] 749s ........................................................................ [ 27%] 750s ........................................................................ [ 28%] 750s ........................................................................ [ 28%] 750s ........................................................................ [ 28%] 750s ........................................................................ [ 29%] 750s ........................................................................ [ 29%] 751s ........................................................................ [ 29%] 751s ........................................................................ [ 30%] 751s ........................................................................ [ 30%] 751s ........................................................................ [ 30%] 751s ........................................................................ [ 31%] 752s ...........................................x............................ [ 31%] 752s ........................................................................ [ 31%] 752s ....................................... [ 31%] 753s tests/test_cftimeindex_resample.py ..................................... [ 32%] 754s ........................................................................ [ 32%] 755s ........................................................................ [ 32%] 756s ........................................................................ [ 33%] 757s ........................................................................ [ 33%] 758s ........................................................................ [ 33%] 759s ........................................................................ [ 34%] 759s ................................................ [ 34%] 760s tests/test_coarsen.py .................................................. [ 34%] 761s ........................................................................ [ 34%] 762s ..........s.......s.......s.......s.......s.......s.......s.......s..... [ 35%] 762s .... [ 35%] 762s tests/test_coding.py ............................... [ 35%] 762s tests/test_coding_strings.py ....................... [ 35%] 763s tests/test_coding_times.py ............................................. [ 35%] 763s ........................................................................ [ 36%] 763s ........................................................................ [ 36%] 764s ........................................................................ [ 36%] 764s ........................................................................ [ 37%] 764s ........................................................................ [ 37%] 765s ........................................................................ [ 37%] 765s ........................................................................ [ 37%] 765s ........................................................................ [ 38%] 765s ........................................................................ [ 38%] 766s ...................s..................................................XX [ 38%] 766s X....................................................................... [ 39%] 766s ........................................................................ [ 39%] 767s ......................................ssssssss......s......s......s..... [ 39%] 768s .s......s............................................................... [ 40%] 768s .......................................................... [ 40%] 769s tests/test_combine.py .......................................x.......... [ 40%] 770s ...................................................... [ 41%] 770s tests/test_computation.py .............................................. [ 41%] 772s ........................................................................ [ 41%] 776s ........................................................................ [ 41%] 780s ........................................................................ [ 42%] 781s ..................................XxXx. [ 42%] 782s tests/test_concat.py ................................................... [ 42%] 782s ................................................. [ 42%] 782s tests/test_conventions.py .................................sssssssssssss [ 43%] 782s ssssssssssssssssssssssssssssssssssssssssssssssssssssss........ [ 43%] 782s tests/test_coordinate_transform.py ............ [ 43%] 783s tests/test_coordinates.py ...................... [ 43%] 785s tests/test_dask.py ..................................................... [ 43%] 807s ..........XXx.X......................................................... [ 44%] 808s .......................................................F................ [ 44%] 809s ...................... [ 44%] 810s tests/test_dataarray.py ................................................ [ 44%] 811s ........................................................................ [ 45%] 811s ........................................................................ [ 45%] 812s ........................................................................ [ 45%] 813s s...ss......................................Xx.......................... [ 46%] 815s ..........................ss....ss...................................... [ 46%] 819s ............x.....................................x.......x............. [ 46%] 820s ................sssssssssssss.................ss...... [ 46%] 919s tests/test_dataarray_typing.yml .............. [ 47%] 922s tests/test_dataset.py .................................................. [ 47%] 923s ........................................................................ [ 47%] 924s ......Xx...................................................s............ [ 47%] 924s ..............................................s......................... [ 48%] 925s ........................................................................ [ 48%] 926s ...............................................................ss....ss. [ 48%] 929s ......................................................................ss [ 49%] 929s ... [ 49%] 1012s tests/test_dataset_typing.yml .............. [ 49%] 1013s tests/test_datatree.py ............................xx..........x......x. [ 49%] 1013s ........................................................................ [ 49%] 1014s .......x.......... [ 49%] 1014s tests/test_datatree_mapping.py .............x........ [ 50%] 1082s tests/test_datatree_typing.yml .............. [ 50%] 1082s tests/test_deprecation_helpers.py .. [ 50%] 1082s tests/test_dtypes.py ................................................... [ 50%] 1082s ...sss... [ 50%] 1083s tests/test_duck_array_ops.py ......s...........s.................XX..... [ 50%] 1084s ................XX.....................XX.....................XX..s..... [ 50%] 1086s ..................................ss..............ss..............ss.... [ 51%] 1088s ..ss......ss..............ss............................................ [ 51%] 1091s ..........ss......ss..............................ss..............ss.... [ 51%] 1094s ..........ss......ss......ss..............ss............................ [ 52%] 1097s ..........................ss......ss................ssssssssss.......... [ 52%] 1098s ssssssssss..........ssssssssss..........ssssssssss..........ssssss...... [ 52%] 1099s ........ssssss..............ssssss..............ssssss..............ssss [ 53%] 1100s sssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s. [ 53%] 1100s 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%] 1102s s.s.s.s.s.s............................................................. [ 54%] 1103s ........................................................................ [ 54%] 1105s ........................................................................ [ 54%] 1106s ........................................................................ [ 55%] 1107s ........................................................................ [ 55%] 1108s ........................................................................ [ 55%] 1114s ........................................................ [ 56%] 1114s tests/test_duck_array_wrapping.py s.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.sxss.s [ 56%] 1115s .ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.s.ssXsxss.sxss.sxss.sxss.s.ss.s.s [ 56%] 1115s sxsxssxsxssxsxss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.sxssxsxss.s.ss.s.ss. [ 56%] 1116s sxss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ssXsxss.s.ss.sxss.sx [ 57%] 1116s ss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss [ 57%] 1116s .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%] 1116s 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%] 1117s s.s.ss.s.ss.s.ss.s.s [ 58%] 1117s tests/test_error_messages.py .. [ 58%] 1117s tests/test_extensions.py .... [ 58%] 1117s tests/test_formatting.py .....................................s......... [ 58%] 1117s ..... [ 58%] 1117s tests/test_formatting_html.py ........................ [ 58%] 1119s tests/test_groupby.py ......................s........................... [ 59%] 1121s ...............................ss....................................... [ 59%] 1122s ........................................................................ [ 59%] 1124s .............................................................sssssssss.. [ 59%] 1125s ..s..............sssssssssss............. [ 60%] 1125s tests/test_hashable.py ........ [ 60%] 1125s tests/test_indexes.py .................................................. [ 60%] 1126s ........................ [ 60%] 1126s tests/test_indexing.py ................................................. [ 60%] 1126s ........................................................................ [ 61%] 1127s ............... [ 61%] 1140s tests/test_interp.py ................................................... [ 61%] 1149s .x...................................................................... [ 61%] 1174s ................................................................sss..sss [ 62%] 1203s ..sss..sss..sss..sss..sss..sss............... [ 62%] 1203s tests/test_merge.py .................................................... [ 62%] 1203s ... [ 62%] 1207s tests/test_missing.py .................................................. [ 62%] 1208s ..................s...........................................x.. [ 63%] 1208s tests/test_namedarray.py ....x...........................s.............. [ 63%] 1208s .. [ 63%] 1208s tests/test_nputils.py .. [ 63%] 1209s tests/test_options.py ................... [ 63%] 1209s tests/test_pandas_to_xarray.py xxxxxxxxxxxxxxxxxxxxxxxsxxxxxx........... [ 63%] 1210s ....................... [ 63%] 1210s tests/test_parallelcompat.py ............... [ 63%] 1212s tests/test_plot.py ..................................................... [ 63%] 1214s ........................................................................ [ 64%] 1220s ........................................................................ [ 64%] 1229s ...............................................s........................ [ 64%] 1240s .............X.......................................................x.. [ 65%] 1287s ss.ssss................................................................. [ 65%] 1291s .......sss.............................................................. [ 65%] 1292s .......................................... [ 66%] 1292s tests/test_plugins.py ...........F. [ 66%] 1292s tests/test_print_versions.py . [ 66%] 1299s tests/test_rolling.py .................................................. [ 66%] 1305s ........................................................................ [ 66%] 1309s ........................................................................ [ 67%] 1311s ........................................................................ [ 67%] 1316s ........................................................................ [ 67%] 1319s ........................................................................ [ 68%] 1320s ........................................................................ [ 68%] 1321s ........................................................................ [ 68%] 1321s ........................................................................ [ 69%] 1322s ........................................................................ [ 69%] 1325s ........................................................................ [ 69%] 1331s ........................................................................ [ 70%] 1335s ........................................................................ [ 70%] 1341s ........................................................................ [ 70%] 1342s ........................................................................ [ 71%] 1342s ........................................................................ [ 71%] 1343s ........................................................................ [ 71%] 1344s ........................................................................ [ 72%] 1349s ........................................................................ [ 72%] 1353s ........................................................................ [ 72%] 1358s ........................................................................ [ 73%] 1359s ........................................................................ [ 73%] 1360s ........................................................................ [ 73%] 1360s ........................................................................ [ 74%] 1362s ........................................................................ [ 74%] 1369s ........................................................................ [ 74%] 1374s ........................................................................ [ 75%] 1378s ........................................................................ [ 75%] 1381s ........................................................................ [ 75%] 1381s ........................................................................ [ 76%] 1382s ........................................................................ [ 76%] 1390s ........................................................................ [ 76%] 1394s ...........ssssssssssssssssssssssssssssssssssssssssss................... [ 77%] 1395s ........................................................................ [ 77%] 1395s ........................................................................ [ 77%] 1396s ........................................................................ [ 77%] 1397s ........................................................................ [ 78%] 1398s ........................................................................ [ 78%] 1398s ........................................................ssssssssssssssss [ 78%] 1399s ........................................................................ [ 79%] 1400s ........................................................................ [ 79%] 1401s ........................................................................ [ 79%] 1402s ........................................................................ [ 80%] 1407s ........................................................................ [ 80%] 1414s ........................................................................ [ 80%] 1420s ssssssssssssssss........................................................ [ 81%] 1427s ........................................................................ [ 81%] 1434s ........................................................................ [ 81%] 1441s ........................................................................ [ 82%] 1451s ........................................................................ [ 82%] 1451s ........sss [ 82%] 1468s tests/test_strategies.py .................... [ 82%] 1468s tests/test_treenode.py .................................. [ 82%] 1470s tests/test_tutorial.py xxss [ 82%] 1471s tests/test_typed_ops.py ..... [ 82%] 1471s tests/test_ufuncs.py ................................................... [ 83%] 1471s .......................................................................x [ 83%] 1471s .. [ 83%] 1472s tests/test_units.py .s..s..s..s......sssssxxxxx.....sssss.xxxx.....sssss [ 83%] 1476s xxxxx.....sssss.xxxx.....sssssxxxxx.....sssss.xxxx.....sssssxxxxx.....ss [ 84%] 1477s sss.xxxx.........sssss..........sssss..........sssss..........sssss..... [ 84%] 1478s .....sssss..........sssss..........sssss..........sssss..........sssss.. [ 84%] 1479s ........sssss..........sssss..........sssss......s..s..s..s..s..s..s..s. [ 85%] 1480s .sx.sx.sx.sx............................................................ [ 85%] 1480s ........................................................................ [ 85%] 1481s ...................ssssssssss..........ssssssssss....................... [ 86%] 1481s ........................................................................ [ 86%] 1481s ...................................ss..XX............ss..XX............. [ 86%] 1481s ........................................................................ [ 87%] 1481s .....................s..s..ss....ss......ss..s.......................ss. [ 87%] 1482s .s...................................................................... [ 87%] 1490s ....x....x......................xxxxx.....xxxxx.x.x.x.x.x.x.x.x.x.x..... [ 88%] 1492s .xxxx................................................................... [ 88%] 1493s ...............x...............sssss.....sssssssssssssss.....sssss.....s [ 88%] 1493s ssssssssssssss.....sssss..........sssss..................s..s..s..s.ssss [ 89%] 1493s ss.s..s..s..s..s..s..s..s.ssssss.s..s..s..s...........ssssssssssssssssss [ 89%] 1493s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 89%] 1496s ........................................................xx..xx..ssssssss [ 90%] 1499s ssssssssssssxx..xx..ssssssssssssssssssss......ss....s......s..s.s.s.s.s. [ 90%] 1499s s...ss....ss....ss....ss....ss....ss....ss....ss...s..s..s.xs.sss.s..s.. [ 90%] 1500s s..s.xs.sss.s.....ss....ss....ss....ss....ss....ss....ss....ss.......sss [ 91%] 1500s ss..........sssss.......ss....ss........................................ [ 91%] 1502s ....................xxxx................................................ [ 91%] 1504s ..................................xx.....sssss.....sssss.....sssss.....s [ 92%] 1504s ssssssssssssss.....sssss.....sssssssssssssss.....sssss.....sssss........ [ 92%] 1505s .......sss...sssxx....s......s......ssssssssssssssssssssssssssssssssssss [ 92%] 1505s ssssssssssssssssssssssssssssssssssssssssssssssssssssss...sss......sss... [ 92%] 1508s ..................................................xx..xx..ssssssssssssss [ 93%] 1510s ssssssxx..xx..ssssssssssssssssssss............ssssssssssss.............. [ 93%] 1512s ..........ssssssssssss...............xx.ssssss...Xx....xx.ssssss...Xx..s [ 93%] 1513s ..s...........ssssssssss....................ssssssssss.................. [ 94%] 1514s s.....ssssssssssssss........s.............s.....ssssssssssssss........s. [ 94%] 1516s .........sssss..........sssss.......x.x.x.... [ 94%] 1516s tests/test_utils.py .................................................... [ 95%] 1516s .............. [ 95%] 1516s tests/test_variable.py ................................................. [ 95%] 1516s ........................................................................ [ 95%] 1516s ........................................................................ [ 96%] 1516s ........................................................................ [ 96%] 1518s ........................................................................ [ 96%] 1529s .................ssss...............x.xX.......xX.......xx.......xx..... [ 97%] 1530s ..xx.......s............................................................ [ 97%] 1530s ........................ssssssssssssssssssssssssssssssssssssssssssssssss [ 97%] 1530s sssssss..........................ssss....................... [ 97%] 1531s tests/test_weighted.py ................................................. [ 98%] 1531s ........................................................ssssssssssssssss [ 98%] 1531s ssssssssssssssssssssssssssssssssssssssssssssssssssssssss................ [ 98%] 1534s ........................................................................ [ 99%] 1536s ........................................................................ [ 99%] 1540s ........................................................................ [ 99%] 1543s ................................... [100%] 1543s 1543s =================================== FAILURES =================================== 1543s _________________ TestZarrDictStore.test_non_existent_store[2] _________________ 1543s 1543s self = 1543s 1543s def test_non_existent_store(self) -> None: 1543s with pytest.raises( 1543s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1543s ): 1543s > xr.open_zarr(f"{uuid.uuid4()}") 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1543s ds = open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1543s store = ZarrStore.open_group( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1543s ) = _get_open_params( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1543s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1543s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1543s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1543s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1543s raise return_result 1543s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1543s return await coro 1543s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1543s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1543s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1543s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1543s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1543s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1543s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1543s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1543s await store._open() 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/51d4854c-4577-4d1f-95e0-fa2e244880a2') 1543s 1543s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1543s if not self.read_only: 1543s self.root.mkdir(parents=True, exist_ok=True) 1543s 1543s if not self.root.exists(): 1543s > raise FileNotFoundError(f"{self.root} does not exist") 1543s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/51d4854c-4577-4d1f-95e0-fa2e244880a2 does not exist 1543s 1543s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1543s 1543s During handling of the above exception, another exception occurred: 1543s 1543s self = 1543s 1543s def test_non_existent_store(self) -> None: 1543s > with pytest.raises( 1543s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1543s ): 1543s E AssertionError: Regex pattern did not match. 1543s E Regex: '(No such file or directory|Unable to find group)' 1543s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/51d4854c-4577-4d1f-95e0-fa2e244880a2 does not exist' 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1543s ______________ TestZarrDirectoryStore.test_non_existent_store[2] _______________ 1543s 1543s self = 1543s 1543s def test_non_existent_store(self) -> None: 1543s with pytest.raises( 1543s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1543s ): 1543s > xr.open_zarr(f"{uuid.uuid4()}") 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1543s ds = open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1543s store = ZarrStore.open_group( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1543s ) = _get_open_params( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1543s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1543s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1543s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1543s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1543s raise return_result 1543s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1543s return await coro 1543s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1543s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1543s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1543s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1543s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1543s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1543s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1543s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1543s await store._open() 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/baf52618-6bc0-4473-a0f9-bd41146ec3af') 1543s 1543s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1543s if not self.read_only: 1543s self.root.mkdir(parents=True, exist_ok=True) 1543s 1543s if not self.root.exists(): 1543s > raise FileNotFoundError(f"{self.root} does not exist") 1543s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/baf52618-6bc0-4473-a0f9-bd41146ec3af does not exist 1543s 1543s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1543s 1543s During handling of the above exception, another exception occurred: 1543s 1543s self = 1543s 1543s def test_non_existent_store(self) -> None: 1543s > with pytest.raises( 1543s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1543s ): 1543s E AssertionError: Regex pattern did not match. 1543s E Regex: '(No such file or directory|Unable to find group)' 1543s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/baf52618-6bc0-4473-a0f9-bd41146ec3af does not exist' 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1543s ________________ TestZarrWriteEmpty.test_non_existent_store[2] _________________ 1543s 1543s self = 1543s 1543s def test_non_existent_store(self) -> None: 1543s with pytest.raises( 1543s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1543s ): 1543s > xr.open_zarr(f"{uuid.uuid4()}") 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1543s ds = open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1543s store = ZarrStore.open_group( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1543s ) = _get_open_params( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1543s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1543s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1543s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1543s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1543s raise return_result 1543s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1543s return await coro 1543s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1543s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1543s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1543s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1543s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1543s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1543s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1543s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1543s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1543s await store._open() 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/0561f1cc-ce4e-44ac-8ee5-cc6b94152ba1') 1543s 1543s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1543s if not self.read_only: 1543s self.root.mkdir(parents=True, exist_ok=True) 1543s 1543s if not self.root.exists(): 1543s > raise FileNotFoundError(f"{self.root} does not exist") 1543s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/0561f1cc-ce4e-44ac-8ee5-cc6b94152ba1 does not exist 1543s 1543s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1543s 1543s During handling of the above exception, another exception occurred: 1543s 1543s self = 1543s 1543s def test_non_existent_store(self) -> None: 1543s > with pytest.raises( 1543s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1543s ): 1543s E AssertionError: Regex pattern did not match. 1543s E Regex: '(No such file or directory|Unable to find group)' 1543s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/0561f1cc-ce4e-44ac-8ee5-cc6b94152ba1 does not exist' 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1543s _______________ TestZarrWriteEmpty.test_write_empty[2-True-True] _______________ 1543s 1543s self = 1543s consolidated = True, write_empty = True 1543s 1543s @pytest.mark.parametrize("consolidated", [True, False, None]) 1543s @pytest.mark.parametrize("write_empty", [True, False, None]) 1543s def test_write_empty( 1543s self, 1543s consolidated: bool | None, 1543s write_empty: bool | None, 1543s ) -> None: 1543s def assert_expected_files(expected: list[str], store: str) -> None: 1543s """Convenience for comparing with actual files written""" 1543s ls = [] 1543s test_root = os.path.join(store, "test") 1543s for root, _, files in os.walk(test_root): 1543s ls.extend( 1543s [ 1543s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1543s for f in files 1543s ] 1543s ) 1543s 1543s assert set(expected) == set( 1543s [ 1543s file.lstrip("c/") 1543s for file in ls 1543s if (file not in (".zattrs", ".zarray", "zarr.json")) 1543s ] 1543s ) 1543s 1543s # The zarr format is set by the `default_zarr_format` 1543s # pytest fixture that acts on a superclass 1543s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1543s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1543s expected = ["0.1.0"] 1543s else: 1543s expected = [ 1543s "0.0.0", 1543s "0.0.1", 1543s "0.1.0", 1543s "0.1.1", 1543s ] 1543s 1543s if zarr_format_3: 1543s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1543s # transform to the path style of zarr 3 1543s # e.g. 0/0/1 1543s expected = [e.replace(".", "/") for e in expected] 1543s else: 1543s # use nan for default fill_value behaviour 1543s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1543s 1543s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1543s 1543s if has_dask: 1543s ds["test"] = ds["test"].chunk(1) 1543s encoding = None 1543s else: 1543s encoding = {"test": {"chunks": (1, 1, 1)}} 1543s 1543s with self.temp_dir() as (d, store): 1543s ds.to_zarr( 1543s store, 1543s mode="w", 1543s encoding=encoding, 1543s write_empty_chunks=write_empty, 1543s ) 1543s 1543s # check expected files after a write 1543s assert_expected_files(expected, store) 1543s 1543s with self.roundtrip_dir( 1543s ds, 1543s store, 1543s save_kwargs={ 1543s "mode": "a", 1543s "append_dim": "Z", 1543s "write_empty_chunks": write_empty, 1543s }, 1543s ) as a_ds: 1543s expected_ds = xr.concat([ds, ds], dim="Z") 1543s 1543s assert_identical(a_ds, expected_ds.compute()) 1543s # add the new files we expect to be created by the append 1543s # that was performed by the roundtrip_dir 1543s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1543s expected.append("1.1.0") 1543s else: 1543s if not has_zarr_v3: 1543s # TODO: remove zarr3 if once zarr issue is fixed 1543s # https://github.com/zarr-developers/zarr-python/issues/2931 1543s expected.extend( 1543s [ 1543s "1.1.0", 1543s "1.0.0", 1543s "1.0.1", 1543s "1.1.1", 1543s ] 1543s ) 1543s else: 1543s expected.append("1.1.0") 1543s if zarr_format_3: 1543s expected = [e.replace(".", "/") for e in expected] 1543s > assert_expected_files(expected, store) 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1543s store = '/tmp/tmpxqp_ifvn/test.zarr' 1543s 1543s def assert_expected_files(expected: list[str], store: str) -> None: 1543s """Convenience for comparing with actual files written""" 1543s ls = [] 1543s test_root = os.path.join(store, "test") 1543s for root, _, files in os.walk(test_root): 1543s ls.extend( 1543s [ 1543s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1543s for f in files 1543s ] 1543s ) 1543s 1543s > assert set(expected) == set( 1543s [ 1543s file.lstrip("c/") 1543s for file in ls 1543s if (file not in (".zattrs", ".zarray", "zarr.json")) 1543s ] 1543s ) 1543s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1543s E 1543s E Extra items in the right set: 1543s E '1.0.0' 1543s E '1.0.1' 1543s E '1.1.1' 1543s E Use -v to get more diff 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1543s ______________ TestZarrWriteEmpty.test_write_empty[2-True-False] _______________ 1543s 1543s self = 1543s consolidated = False, write_empty = True 1543s 1543s @pytest.mark.parametrize("consolidated", [True, False, None]) 1543s @pytest.mark.parametrize("write_empty", [True, False, None]) 1543s def test_write_empty( 1543s self, 1543s consolidated: bool | None, 1543s write_empty: bool | None, 1543s ) -> None: 1543s def assert_expected_files(expected: list[str], store: str) -> None: 1543s """Convenience for comparing with actual files written""" 1543s ls = [] 1543s test_root = os.path.join(store, "test") 1543s for root, _, files in os.walk(test_root): 1543s ls.extend( 1543s [ 1543s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1543s for f in files 1543s ] 1543s ) 1543s 1543s assert set(expected) == set( 1543s [ 1543s file.lstrip("c/") 1543s for file in ls 1543s if (file not in (".zattrs", ".zarray", "zarr.json")) 1543s ] 1543s ) 1543s 1543s # The zarr format is set by the `default_zarr_format` 1543s # pytest fixture that acts on a superclass 1543s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1543s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1543s expected = ["0.1.0"] 1543s else: 1543s expected = [ 1543s "0.0.0", 1543s "0.0.1", 1543s "0.1.0", 1543s "0.1.1", 1543s ] 1543s 1543s if zarr_format_3: 1543s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1543s # transform to the path style of zarr 3 1543s # e.g. 0/0/1 1543s expected = [e.replace(".", "/") for e in expected] 1543s else: 1543s # use nan for default fill_value behaviour 1543s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1543s 1543s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1543s 1543s if has_dask: 1543s ds["test"] = ds["test"].chunk(1) 1543s encoding = None 1543s else: 1543s encoding = {"test": {"chunks": (1, 1, 1)}} 1543s 1543s with self.temp_dir() as (d, store): 1543s ds.to_zarr( 1543s store, 1543s mode="w", 1543s encoding=encoding, 1543s write_empty_chunks=write_empty, 1543s ) 1543s 1543s # check expected files after a write 1543s assert_expected_files(expected, store) 1543s 1543s with self.roundtrip_dir( 1543s ds, 1543s store, 1543s save_kwargs={ 1543s "mode": "a", 1543s "append_dim": "Z", 1543s "write_empty_chunks": write_empty, 1543s }, 1543s ) as a_ds: 1543s expected_ds = xr.concat([ds, ds], dim="Z") 1543s 1543s assert_identical(a_ds, expected_ds.compute()) 1543s # add the new files we expect to be created by the append 1543s # that was performed by the roundtrip_dir 1543s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1543s expected.append("1.1.0") 1543s else: 1543s if not has_zarr_v3: 1543s # TODO: remove zarr3 if once zarr issue is fixed 1543s # https://github.com/zarr-developers/zarr-python/issues/2931 1543s expected.extend( 1543s [ 1543s "1.1.0", 1543s "1.0.0", 1543s "1.0.1", 1543s "1.1.1", 1543s ] 1543s ) 1543s else: 1543s expected.append("1.1.0") 1543s if zarr_format_3: 1543s expected = [e.replace(".", "/") for e in expected] 1543s > assert_expected_files(expected, store) 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1543s store = '/tmp/tmp7rtp78xq/test.zarr' 1543s 1543s def assert_expected_files(expected: list[str], store: str) -> None: 1543s """Convenience for comparing with actual files written""" 1543s ls = [] 1543s test_root = os.path.join(store, "test") 1543s for root, _, files in os.walk(test_root): 1543s ls.extend( 1543s [ 1543s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1543s for f in files 1543s ] 1543s ) 1543s 1543s > assert set(expected) == set( 1543s [ 1543s file.lstrip("c/") 1543s for file in ls 1543s if (file not in (".zattrs", ".zarray", "zarr.json")) 1543s ] 1543s ) 1543s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1543s E 1543s E Extra items in the right set: 1543s E '1.1.1' 1543s E '1.0.0' 1543s E '1.0.1' 1543s E Use -v to get more diff 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1543s _______________ TestZarrWriteEmpty.test_write_empty[2-True-None] _______________ 1543s 1543s self = 1543s consolidated = None, write_empty = True 1543s 1543s @pytest.mark.parametrize("consolidated", [True, False, None]) 1543s @pytest.mark.parametrize("write_empty", [True, False, None]) 1543s def test_write_empty( 1543s self, 1543s consolidated: bool | None, 1543s write_empty: bool | None, 1543s ) -> None: 1543s def assert_expected_files(expected: list[str], store: str) -> None: 1543s """Convenience for comparing with actual files written""" 1543s ls = [] 1543s test_root = os.path.join(store, "test") 1543s for root, _, files in os.walk(test_root): 1543s ls.extend( 1543s [ 1543s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1543s for f in files 1543s ] 1543s ) 1543s 1543s assert set(expected) == set( 1543s [ 1543s file.lstrip("c/") 1543s for file in ls 1543s if (file not in (".zattrs", ".zarray", "zarr.json")) 1543s ] 1543s ) 1543s 1543s # The zarr format is set by the `default_zarr_format` 1543s # pytest fixture that acts on a superclass 1543s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1543s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1543s expected = ["0.1.0"] 1543s else: 1543s expected = [ 1543s "0.0.0", 1543s "0.0.1", 1543s "0.1.0", 1543s "0.1.1", 1543s ] 1543s 1543s if zarr_format_3: 1543s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1543s # transform to the path style of zarr 3 1543s # e.g. 0/0/1 1543s expected = [e.replace(".", "/") for e in expected] 1543s else: 1543s # use nan for default fill_value behaviour 1543s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1543s 1543s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1543s 1543s if has_dask: 1543s ds["test"] = ds["test"].chunk(1) 1543s encoding = None 1543s else: 1543s encoding = {"test": {"chunks": (1, 1, 1)}} 1543s 1543s with self.temp_dir() as (d, store): 1543s ds.to_zarr( 1543s store, 1543s mode="w", 1543s encoding=encoding, 1543s write_empty_chunks=write_empty, 1543s ) 1543s 1543s # check expected files after a write 1543s assert_expected_files(expected, store) 1543s 1543s with self.roundtrip_dir( 1543s ds, 1543s store, 1543s save_kwargs={ 1543s "mode": "a", 1543s "append_dim": "Z", 1543s "write_empty_chunks": write_empty, 1543s }, 1543s ) as a_ds: 1543s expected_ds = xr.concat([ds, ds], dim="Z") 1543s 1543s assert_identical(a_ds, expected_ds.compute()) 1543s # add the new files we expect to be created by the append 1543s # that was performed by the roundtrip_dir 1543s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1543s expected.append("1.1.0") 1543s else: 1543s if not has_zarr_v3: 1543s # TODO: remove zarr3 if once zarr issue is fixed 1543s # https://github.com/zarr-developers/zarr-python/issues/2931 1543s expected.extend( 1543s [ 1543s "1.1.0", 1543s "1.0.0", 1543s "1.0.1", 1543s "1.1.1", 1543s ] 1543s ) 1543s else: 1543s expected.append("1.1.0") 1543s if zarr_format_3: 1543s expected = [e.replace(".", "/") for e in expected] 1543s > assert_expected_files(expected, store) 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1543s store = '/tmp/tmpzorqzu_h/test.zarr' 1543s 1543s def assert_expected_files(expected: list[str], store: str) -> None: 1543s """Convenience for comparing with actual files written""" 1543s ls = [] 1543s test_root = os.path.join(store, "test") 1543s for root, _, files in os.walk(test_root): 1543s ls.extend( 1543s [ 1543s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1543s for f in files 1543s ] 1543s ) 1543s 1543s > assert set(expected) == set( 1543s [ 1543s file.lstrip("c/") 1543s for file in ls 1543s if (file not in (".zattrs", ".zarray", "zarr.json")) 1543s ] 1543s ) 1543s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1543s E 1543s E Extra items in the right set: 1543s E '1.0.0' 1543s E '1.0.1' 1543s E '1.1.1' 1543s E Use -v to get more diff 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1543s _____________ TestZarrDictStore.test_zero_dimensional_variable[3] ______________ 1543s 1543s self = 1543s 1543s def test_zero_dimensional_variable(self) -> None: 1543s expected = create_test_data() 1543s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1543s expected["bytes_var"] = ([], b"foobar") 1543s expected["string_var"] = ([], "foobar") 1543s > with self.roundtrip(expected) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ____________________ TestZarrDictStore.test_write_store[3] _____________________ 1543s 1543s self = 1543s 1543s def test_write_store(self) -> None: 1543s expected = create_test_data() 1543s with self.create_store() as store: 1543s expected.dump_to_store(store) 1543s # we need to cf decode the store because it has time and 1543s # non-dimension coordinates 1543s > with xr.decode_cf(store) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1543s vars, attrs = obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'var2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ________________ TestZarrDictStore.test_roundtrip_test_data[3] _________________ 1543s 1543s self = 1543s 1543s def test_roundtrip_test_data(self) -> None: 1543s expected = create_test_data() 1543s > with self.roundtrip(expected) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ________________________ TestZarrDictStore.test_load[3] ________________________ 1543s 1543s self = 1543s 1543s def test_load(self) -> None: 1543s expected = create_test_data() 1543s 1543s @contextlib.contextmanager 1543s def assert_loads(vars=None): 1543s if vars is None: 1543s vars = expected 1543s with self.roundtrip(expected) as actual: 1543s for k, v in actual.variables.items(): 1543s # IndexVariables are eagerly loaded into memory 1543s assert v._in_memory == (k in actual.dims) 1543s yield actual 1543s for k, v in actual.variables.items(): 1543s if k in vars: 1543s assert v._in_memory 1543s assert_identical(expected, actual) 1543s 1543s with pytest.raises(AssertionError): 1543s # make sure the contextmanager works! 1543s > with assert_loads() as ds: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1543s with self.roundtrip(expected) as actual: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s __________________ TestZarrDictStore.test_dataset_compute[3] ___________________ 1543s 1543s self = 1543s 1543s def test_dataset_compute(self) -> None: 1543s expected = create_test_data() 1543s 1543s > with self.roundtrip(expected) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s _______________ TestZarrDictStore.test_roundtrip_object_dtype[3] _______________ 1543s 1543s self = 1543s 1543s def test_roundtrip_object_dtype(self) -> None: 1543s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1543s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1543s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1543s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1543s strings = np.array(["ab", "cdef", "g"], dtype=object) 1543s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1543s all_nans = np.array([np.nan, np.nan], dtype=object) 1543s original = Dataset( 1543s { 1543s "floats": ("a", floats), 1543s "floats_nans": ("a", floats_nans), 1543s "bytes": ("b", bytes_), 1543s "bytes_nans": ("b", bytes_nans), 1543s "strings": ("b", strings), 1543s "strings_nans": ("b", strings_nans), 1543s "all_nans": ("c", all_nans), 1543s "nan": ([], np.nan), 1543s } 1543s ) 1543s expected = original.copy(deep=True) 1543s > with self.roundtrip(original) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'nan' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s _______________ TestZarrDictStore.test_roundtrip_float64_data[3] _______________ 1543s 1543s self = 1543s 1543s def test_roundtrip_float64_data(self) -> None: 1543s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1543s > with self.roundtrip(expected) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'x' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ________________ TestZarrDictStore.test_orthogonal_indexing[3] _________________ 1543s 1543s self = 1543s 1543s def test_orthogonal_indexing(self) -> None: 1543s in_memory = create_test_data() 1543s > with self.roundtrip(in_memory) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ________________ TestZarrDictStore.test_vectorized_indexing[3] _________________ 1543s 1543s self = 1543s 1543s def test_vectorized_indexing(self) -> None: 1543s in_memory = create_test_data() 1543s > with self.roundtrip(in_memory) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s _________ TestZarrDictStore.test_vectorized_indexing_negative_step[3] __________ 1543s 1543s self = 1543s 1543s def test_vectorized_indexing_negative_step(self) -> None: 1543s # use dask explicitly when present 1543s open_kwargs: dict[str, Any] | None 1543s if has_dask: 1543s open_kwargs = {"chunks": {}} 1543s else: 1543s open_kwargs = None 1543s in_memory = create_test_data() 1543s 1543s def multiple_indexing(indexers): 1543s # make sure a sequence of lazy indexings certainly works. 1543s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1543s actual = on_disk["var3"] 1543s expected = in_memory["var3"] 1543s for ind in indexers: 1543s actual = actual.isel(ind) 1543s expected = expected.isel(ind) 1543s # make sure the array is not yet loaded into memory 1543s assert not actual.variable._in_memory 1543s assert_identical(expected, actual.load()) 1543s 1543s # with negative step slice. 1543s indexers = [ 1543s { 1543s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1543s "dim3": slice(-1, 1, -1), 1543s } 1543s ] 1543s > multiple_indexing(indexers) 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1543s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ______________ TestZarrDictStore.test_outer_indexing_reversed[3] _______________ 1543s 1543s self = 1543s 1543s def test_outer_indexing_reversed(self) -> None: 1543s # regression test for GH6560 1543s ds = xr.Dataset( 1543s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1543s ) 1543s 1543s > with self.roundtrip(ds) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'z' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ___________________ TestZarrDictStore.test_isel_dataarray[3] ___________________ 1543s 1543s self = 1543s 1543s def test_isel_dataarray(self) -> None: 1543s # Make sure isel works lazily. GH:issue:1688 1543s in_memory = create_test_data() 1543s > with self.roundtrip(in_memory) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s _____________ TestZarrDictStore.test_array_type_after_indexing[3] ______________ 1543s 1543s self = 1543s 1543s def test_array_type_after_indexing(self) -> None: 1543s in_memory = create_test_data() 1543s > with self.roundtrip(in_memory) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s _______________________ TestZarrDictStore.test_dropna[3] _______________________ 1543s 1543s self = 1543s 1543s def test_dropna(self) -> None: 1543s # regression test for GH:issue:1694 1543s a = np.random.randn(4, 3) 1543s a[1, 1] = np.nan 1543s in_memory = xr.Dataset( 1543s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1543s ) 1543s 1543s assert_identical( 1543s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1543s ) 1543s 1543s > with self.roundtrip(in_memory) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'a' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s _________________ TestZarrDictStore.test_ondisk_after_print[3] _________________ 1543s 1543s self = 1543s 1543s def test_ondisk_after_print(self) -> None: 1543s """Make sure print does not load file into memory""" 1543s in_memory = create_test_data() 1543s > with self.roundtrip(in_memory) as on_disk: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'dim2' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Float64' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s __________ TestZarrDictStore.test_roundtrip_bytes_with_fill_value[3] ___________ 1543s 1543s self = 1543s 1543s def test_roundtrip_bytes_with_fill_value(self) -> None: 1543s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1543s encoding = {"_FillValue": b"X", "dtype": "S1"} 1543s original = Dataset({"x": ("t", values, {}, encoding)}) 1543s expected = original.copy(deep=True) 1543s > with self.roundtrip(original) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'x' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value0-False] ________ 1543s 1543s self = 1543s fill_value = np.int8(-1), exp_fill_warning = False 1543s 1543s @pytest.mark.parametrize( 1543s ("fill_value", "exp_fill_warning"), 1543s [ 1543s (np.int8(-1), False), 1543s (np.uint8(255), True), 1543s (-1, False), 1543s (255, True), 1543s ], 1543s ) 1543s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1543s @contextlib.contextmanager 1543s def _roundtrip_with_warnings(*args, **kwargs): 1543s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1543s if exp_fill_warning and is_np2: 1543s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1543s SerializationWarning, 1543s match="_FillValue attribute can't be represented", 1543s ) 1543s else: 1543s warn_checker = contextlib.nullcontext() 1543s with warn_checker: 1543s with self.roundtrip(*args, **kwargs) as actual: 1543s yield actual 1543s 1543s # regression/numpy2 test for 1543s encoding = { 1543s "_FillValue": fill_value, 1543s "_Unsigned": "true", 1543s "dtype": "i1", 1543s } 1543s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1543s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1543s 1543s attributes = { 1543s "_FillValue": fill_value, 1543s "_Unsigned": "true", 1543s } 1543s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1543s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1543s encoded = Dataset({"x": ("t", sb, attributes)}) 1543s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1543s 1543s > with _roundtrip_with_warnings(decoded) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1543s with self.roundtrip(*args, **kwargs) as actual: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1543s with xr.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1543s backend_ds = backend.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1543s ds = store_entrypoint.open_dataset( 1543s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1543s vars, attrs = filename_or_obj.load() 1543s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1543s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1543s return Frozen(dict(*args, **kwargs)) 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1543s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s 1543s self = , name = 'x' 1543s 1543s def open_store_variable(self, name): 1543s zarr_array = self.members[name] 1543s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1543s try_nczarr = self._mode == "r" 1543s dimensions, attributes = _get_zarr_dims_and_attrs( 1543s zarr_array, DIMENSION_KEY, try_nczarr 1543s ) 1543s attributes = dict(attributes) 1543s 1543s encoding = { 1543s "chunks": zarr_array.chunks, 1543s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1543s } 1543s 1543s if _zarr_v3(): 1543s encoding.update( 1543s { 1543s "compressors": zarr_array.compressors, 1543s "filters": zarr_array.filters, 1543s "shards": zarr_array.shards, 1543s } 1543s ) 1543s if self.zarr_group.metadata.zarr_format == 3: 1543s encoding.update({"serializer": zarr_array.serializer}) 1543s else: 1543s encoding.update( 1543s { 1543s "compressor": zarr_array.compressor, 1543s "filters": zarr_array.filters, 1543s } 1543s ) 1543s 1543s if self._use_zarr_fill_value_as_mask: 1543s # Setting this attribute triggers CF decoding for missing values 1543s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1543s if zarr_array.fill_value is not None: 1543s attributes["_FillValue"] = zarr_array.fill_value 1543s elif "_FillValue" in attributes: 1543s original_zarr_dtype = zarr_array.metadata.data_type 1543s attributes["_FillValue"] = FillValueCoder.decode( 1543s > attributes["_FillValue"], original_zarr_dtype.value 1543s ) 1543s E AttributeError: 'Int8' object has no attribute 'value' 1543s 1543s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1543s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value1-True] _________ 1543s 1543s self = 1543s fill_value = np.uint8(255), exp_fill_warning = True 1543s 1543s @pytest.mark.parametrize( 1543s ("fill_value", "exp_fill_warning"), 1543s [ 1543s (np.int8(-1), False), 1543s (np.uint8(255), True), 1543s (-1, False), 1543s (255, True), 1543s ], 1543s ) 1543s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1543s @contextlib.contextmanager 1543s def _roundtrip_with_warnings(*args, **kwargs): 1543s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1543s if exp_fill_warning and is_np2: 1543s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1543s SerializationWarning, 1543s match="_FillValue attribute can't be represented", 1543s ) 1543s else: 1543s warn_checker = contextlib.nullcontext() 1543s with warn_checker: 1543s with self.roundtrip(*args, **kwargs) as actual: 1543s yield actual 1543s 1543s # regression/numpy2 test for 1543s encoding = { 1543s "_FillValue": fill_value, 1543s "_Unsigned": "true", 1543s "dtype": "i1", 1543s } 1543s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1543s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1543s 1543s attributes = { 1543s "_FillValue": fill_value, 1543s "_Unsigned": "true", 1543s } 1543s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1543s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1543s encoded = Dataset({"x": ("t", sb, attributes)}) 1543s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1543s 1543s > with _roundtrip_with_warnings(decoded) as actual: 1543s 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1543s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1543s with self.roundtrip(*args, **kwargs) as actual: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1543s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1543s with self.open(store_target, **open_kwargs) as ds: 1543s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1543s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Int8' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________ TestZarrDictStore.test_roundtrip_unsigned[3--1-False] _____________ 1544s 1544s self = 1544s fill_value = -1, exp_fill_warning = False 1544s 1544s @pytest.mark.parametrize( 1544s ("fill_value", "exp_fill_warning"), 1544s [ 1544s (np.int8(-1), False), 1544s (np.uint8(255), True), 1544s (-1, False), 1544s (255, True), 1544s ], 1544s ) 1544s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1544s @contextlib.contextmanager 1544s def _roundtrip_with_warnings(*args, **kwargs): 1544s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1544s if exp_fill_warning and is_np2: 1544s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1544s SerializationWarning, 1544s match="_FillValue attribute can't be represented", 1544s ) 1544s else: 1544s warn_checker = contextlib.nullcontext() 1544s with warn_checker: 1544s with self.roundtrip(*args, **kwargs) as actual: 1544s yield actual 1544s 1544s # regression/numpy2 test for 1544s encoding = { 1544s "_FillValue": fill_value, 1544s "_Unsigned": "true", 1544s "dtype": "i1", 1544s } 1544s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1544s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1544s 1544s attributes = { 1544s "_FillValue": fill_value, 1544s "_Unsigned": "true", 1544s } 1544s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1544s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1544s encoded = Dataset({"x": ("t", sb, attributes)}) 1544s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1544s 1544s > with _roundtrip_with_warnings(decoded) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1544s with self.roundtrip(*args, **kwargs) as actual: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Int8' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________ TestZarrDictStore.test_roundtrip_unsigned[3-255-True] _____________ 1544s 1544s self = 1544s fill_value = 255, exp_fill_warning = True 1544s 1544s @pytest.mark.parametrize( 1544s ("fill_value", "exp_fill_warning"), 1544s [ 1544s (np.int8(-1), False), 1544s (np.uint8(255), True), 1544s (-1, False), 1544s (255, True), 1544s ], 1544s ) 1544s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1544s @contextlib.contextmanager 1544s def _roundtrip_with_warnings(*args, **kwargs): 1544s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1544s if exp_fill_warning and is_np2: 1544s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1544s SerializationWarning, 1544s match="_FillValue attribute can't be represented", 1544s ) 1544s else: 1544s warn_checker = contextlib.nullcontext() 1544s with warn_checker: 1544s with self.roundtrip(*args, **kwargs) as actual: 1544s yield actual 1544s 1544s # regression/numpy2 test for 1544s encoding = { 1544s "_FillValue": fill_value, 1544s "_Unsigned": "true", 1544s "dtype": "i1", 1544s } 1544s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1544s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1544s 1544s attributes = { 1544s "_FillValue": fill_value, 1544s "_Unsigned": "true", 1544s } 1544s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1544s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1544s encoded = Dataset({"x": ("t", sb, attributes)}) 1544s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1544s 1544s > with _roundtrip_with_warnings(decoded) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1544s with self.roundtrip(*args, **kwargs) as actual: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Int8' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1544s 1544s self = 1544s 1544s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1544s original = self._create_cf_dataset() 1544s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'det_lim' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____ TestZarrDictStore.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1544s 1544s self = 1544s 1544s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1544s original = self._create_cf_dataset() 1544s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'det_lim' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1544s 1544s self = 1544s 1544s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1544s self, 1544s ) -> None: 1544s original = self._create_cf_dataset() 1544s # The DataArray roundtrip should have the same warnings as the 1544s # Dataset, but we already tested for those, so just go for the 1544s # new warnings. It would appear that there is no way to tell 1544s # pytest "This warning and also this warning should both be 1544s # present". 1544s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1544s # needs the to_dataset. The other backends should be fine 1544s # without it. 1544s with pytest.warns( 1544s UserWarning, 1544s match=( 1544s r"Variable\(s\) referenced in bounds not in variables: " 1544s r"\['l(at|ong)itude_bnds'\]" 1544s ), 1544s ): 1544s > with self.roundtrip( 1544s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'ln_p' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s 1544s During handling of the above exception, another exception occurred: 1544s 1544s self = 1544s 1544s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1544s self, 1544s ) -> None: 1544s original = self._create_cf_dataset() 1544s # The DataArray roundtrip should have the same warnings as the 1544s # Dataset, but we already tested for those, so just go for the 1544s # new warnings. It would appear that there is no way to tell 1544s # pytest "This warning and also this warning should both be 1544s # present". 1544s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1544s # needs the to_dataset. The other backends should be fine 1544s # without it. 1544s > with pytest.warns( 1544s UserWarning, 1544s match=( 1544s r"Variable\(s\) referenced in bounds not in variables: " 1544s r"\['l(at|ong)itude_bnds'\]" 1544s ), 1544s ): 1544s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1544s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1544s 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.')]. 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1544s ___________________ TestZarrDictStore.test_encoding_kwarg[3] ___________________ 1544s 1544s self = 1544s 1544s def test_encoding_kwarg(self) -> None: 1544s ds = Dataset({"x": ("y", np.arange(10.0))}) 1544s 1544s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1544s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float32' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________________ TestZarrDictStore.test_default_fill_value[3] _________________ 1544s 1544s self = 1544s 1544s def test_default_fill_value(self) -> None: 1544s # Test default encoding for float: 1544s ds = Dataset({"x": ("y", np.arange(10.0))}) 1544s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1544s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float32' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord[3] _________ 1544s 1544s self = 1544s 1544s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1544s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1544s ds.y.encoding["_FillValue"] = None 1544s > with self.roundtrip(ds) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1544s 1544s self = 1544s 1544s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1544s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1544s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1544s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________________ TestZarrDictStore.test_encoding_same_dtype[3] _________________ 1544s 1544s self = 1544s 1544s def test_encoding_same_dtype(self) -> None: 1544s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1544s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1544s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float32' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ______________ TestZarrDictStore.test_append_overwrite_values[3] _______________ 1544s 1544s self = 1544s 1544s def test_append_overwrite_values(self) -> None: 1544s # regression for GH1215 1544s data = create_test_data() 1544s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1544s self.save(data, tmp_file, mode="w") 1544s data["var2"][:] = -999 1544s data["var9"] = data["var2"] * 3 1544s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1544s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-False] ____________ 1544s 1544s self = 1544s consolidated = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s def test_roundtrip_consolidated(self, consolidated) -> None: 1544s expected = create_test_data() 1544s > with self.roundtrip( 1544s expected, 1544s save_kwargs={"consolidated": consolidated}, 1544s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'var2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-True] _____________ 1544s 1544s self = 1544s consolidated = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s def test_roundtrip_consolidated(self, consolidated) -> None: 1544s expected = create_test_data() 1544s > with self.roundtrip( 1544s expected, 1544s save_kwargs={"consolidated": consolidated}, 1544s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-None] _____________ 1544s 1544s self = 1544s consolidated = None 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s def test_roundtrip_consolidated(self, consolidated) -> None: 1544s expected = create_test_data() 1544s > with self.roundtrip( 1544s expected, 1544s save_kwargs={"consolidated": consolidated}, 1544s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ___________ TestZarrDictStore.test_read_non_consolidated_warning[3] ____________ 1544s 1544s self = 1544s 1544s def test_read_non_consolidated_warning(self) -> None: 1544s expected = create_test_data() 1544s with self.create_zarr_target() as store: 1544s self.save( 1544s expected, store_target=store, consolidated=False, **self.version_kwargs 1544s ) 1544s with pytest.warns( 1544s RuntimeWarning, 1544s match="Failed to open Zarr store with consolidated", 1544s ): 1544s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'var2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________________ TestZarrDictStore.test_non_existent_store[3] _________________ 1544s 1544s self = 1544s 1544s def test_non_existent_store(self) -> None: 1544s with pytest.raises( 1544s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1544s ): 1544s > xr.open_zarr(f"{uuid.uuid4()}") 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1544s store = ZarrStore.open_group( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1544s ) = _get_open_params( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1544s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1544s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1544s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1544s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1544s raise return_result 1544s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1544s return await coro 1544s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1544s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1544s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1544s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1544s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1544s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1544s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1544s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1544s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1544s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1544s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1544s await store._open() 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/13f39e1e-b777-497a-8530-888731752aed') 1544s 1544s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1544s if not self.read_only: 1544s self.root.mkdir(parents=True, exist_ok=True) 1544s 1544s if not self.root.exists(): 1544s > raise FileNotFoundError(f"{self.root} does not exist") 1544s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/13f39e1e-b777-497a-8530-888731752aed does not exist 1544s 1544s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1544s 1544s During handling of the above exception, another exception occurred: 1544s 1544s self = 1544s 1544s def test_non_existent_store(self) -> None: 1544s > with pytest.raises( 1544s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1544s ): 1544s E AssertionError: Regex pattern did not match. 1544s E Regex: '(No such file or directory|Unable to find group)' 1544s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/13f39e1e-b777-497a-8530-888731752aed does not exist' 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1544s _____________________ TestZarrDictStore.test_auto_chunk[3] _____________________ 1544s 1544s self = 1544s 1544s @requires_dask 1544s def test_auto_chunk(self) -> None: 1544s original = create_test_data().chunk() 1544s 1544s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________________ TestZarrDictStore.test_manual_chunk[3] ____________________ 1544s 1544s self = 1544s 1544s @requires_dask 1544s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1544s def test_manual_chunk(self) -> None: 1544s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1544s 1544s # Using chunks = None should return non-chunked arrays 1544s open_kwargs: dict[str, Any] = {"chunks": None} 1544s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _______________ TestZarrDictStore.test_warning_on_bad_chunks[3] ________________ 1544s 1544s self = 1544s 1544s @requires_dask 1544s def test_warning_on_bad_chunks(self) -> None: 1544s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1544s 1544s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1544s for chunks in bad_chunks: 1544s kwargs = {"chunks": chunks} 1544s with pytest.warns(UserWarning): 1544s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ______________ TestZarrDictStore.test_write_uneven_dask_chunks[3] ______________ 1544s 1544s self = 1544s 1544s @requires_dask 1544s def test_write_uneven_dask_chunks(self) -> None: 1544s # regression for GH#2225 1544s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1544s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ___________________ TestZarrDictStore.test_chunk_encoding[3] ___________________ 1544s 1544s self = 1544s 1544s def test_chunk_encoding(self) -> None: 1544s # These datasets have no dask chunks. All chunking specified in 1544s # encoding 1544s data = create_test_data() 1544s chunks = (5, 5) 1544s data["var2"].encoding.update({"chunks": chunks}) 1544s 1544s > with self.roundtrip(data) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ___________________ TestZarrDictStore.test_shard_encoding[3] ___________________ 1544s 1544s self = 1544s 1544s def test_shard_encoding(self) -> None: 1544s # These datasets have no dask chunks. All chunking/sharding specified in 1544s # encoding 1544s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1544s data = create_test_data() 1544s chunks = (1, 1) 1544s shards = (5, 5) 1544s data["var2"].encoding.update({"chunks": chunks}) 1544s data["var2"].encoding.update({"shards": shards}) 1544s > with self.roundtrip(data) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________ TestZarrDictStore.test_write_persistence_modes[3-None] ____________ 1544s 1544s self = 1544s group = None 1544s 1544s @pytest.mark.parametrize("group", [None, "group1"]) 1544s def test_write_persistence_modes(self, group) -> None: 1544s original = create_test_data() 1544s 1544s # overwrite mode 1544s > with self.roundtrip( 1544s original, 1544s save_kwargs={"mode": "w", "group": group}, 1544s open_kwargs={"group": group}, 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ___________ TestZarrDictStore.test_write_persistence_modes[3-group1] ___________ 1544s 1544s self = 1544s group = 'group1' 1544s 1544s @pytest.mark.parametrize("group", [None, "group1"]) 1544s def test_write_persistence_modes(self, group) -> None: 1544s original = create_test_data() 1544s 1544s # overwrite mode 1544s > with self.roundtrip( 1544s original, 1544s save_kwargs={"mode": "w", "group": group}, 1544s open_kwargs={"group": group}, 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________________ TestZarrDictStore.test_compressor_encoding[3] _________________ 1544s 1544s self = 1544s 1544s def test_compressor_encoding(self) -> None: 1544s # specify a custom compressor 1544s original = create_test_data() 1544s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1544s encoding_key = "compressors" 1544s # all parameters need to be explicitly specified in order for the comparison to pass below 1544s encoding = { 1544s "serializer": zarr.codecs.BytesCodec(endian="little"), 1544s encoding_key: ( 1544s zarr.codecs.BloscCodec( 1544s cname="zstd", 1544s clevel=3, 1544s shuffle="shuffle", 1544s typesize=8, 1544s blocksize=0, 1544s ), 1544s ), 1544s } 1544s else: 1544s from numcodecs.blosc import Blosc 1544s 1544s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1544s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1544s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1544s 1544s save_kwargs = dict(encoding={"var1": encoding}) 1544s 1544s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _______________________ TestZarrDictStore.test_group[3] ________________________ 1544s 1544s self = 1544s 1544s def test_group(self) -> None: 1544s original = create_test_data() 1544s group = "some/random/path" 1544s > with self.roundtrip( 1544s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ____________________ TestZarrDictStore.test_append_write[3] ____________________ 1544s 1544s self = 1544s 1544s def test_append_write(self) -> None: 1544s > super().test_append_write() 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1544s with self.roundtrip_append(data) as actual: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1544s self.save(data[[key]], path, mode=mode, **save_kwargs) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1544s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _______ TestZarrDictStore.test_append_with_append_dim_not_set_raises[3] ________ 1544s 1544s self = 1544s 1544s def test_append_with_append_dim_not_set_raises(self) -> None: 1544s ds, ds_to_append, _ = create_append_test_data() 1544s with self.create_zarr_target() as store_target: 1544s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1544s with pytest.raises(ValueError, match="different dimension sizes"): 1544s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'da' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-U] ________ 1544s 1544s self = 1544s dtype = 'U' 1544s 1544s @pytest.mark.parametrize("dtype", ["U", "S"]) 1544s def test_append_string_length_mismatch_works(self, dtype) -> None: 1544s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1544s # ...but it probably would if we used object dtype 1544s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1544s expected = xr.concat([ds, ds_to_append], dim="time") 1544s with self.create_zarr_target() as store_target: 1544s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1544s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1544s _validate_datatypes_for_zarr_append( 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s vname = 'temperature' 1544s existing_var = Size: 24B 1544s [3 values with dtype= Size: 60B 1544s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1544s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1544s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1544s f"dataset to append has dtype {new_var.dtype}." 1544s ) 1544s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1544s dtype = 'S' 1544s 1544s @pytest.mark.parametrize("dtype", ["U", "S"]) 1544s def test_append_string_length_mismatch_works(self, dtype) -> None: 1544s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1544s # ...but it probably would if we used object dtype 1544s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1544s expected = xr.concat([ds, ds_to_append], dim="time") 1544s with self.create_zarr_target() as store_target: 1544s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1544s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1544s _validate_datatypes_for_zarr_append( 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s vname = 'temperature' 1544s existing_var = Size: 6B 1544s [3 values with dtype=|S2] 1544s new_var = Size: 9B 1544s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1544s 1544s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1544s """If variable exists in the store, confirm dtype of the data to append is compatible with 1544s existing dtype. 1544s """ 1544s if ( 1544s np.issubdtype(new_var.dtype, np.number) 1544s or np.issubdtype(new_var.dtype, np.datetime64) 1544s or np.issubdtype(new_var.dtype, np.bool_) 1544s or new_var.dtype == object 1544s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1544s ): 1544s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1544s # new to the dataset, because in this case there is no existing var to compare it to; 1544s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1544s # we can be confident appending won't cause problems. Examples of dtypes which are not 1544s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1544s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1544s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1544s f"dataset to append has dtype {new_var.dtype}." 1544s ) 1544s 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. 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1544s _____ TestZarrDictStore.test_check_encoding_is_consistent_after_append[3] ______ 1544s 1544s self = 1544s 1544s def test_check_encoding_is_consistent_after_append(self) -> None: 1544s ds, ds_to_append, _ = create_append_test_data() 1544s 1544s # check encoding consistency 1544s with self.create_zarr_target() as store_target: 1544s import numcodecs 1544s 1544s encoding_value: Any 1544s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1544s compressor = zarr.codecs.BloscCodec() 1544s else: 1544s compressor = numcodecs.Blosc() 1544s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1544s encoding_value = (compressor,) if has_zarr_v3 else compressor 1544s 1544s encoding = {"da": {encoding_key: encoding_value}} 1544s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1544s > original_ds = xr.open_dataset( 1544s store_target, engine="zarr", **self.version_kwargs 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'da' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ______________ TestZarrDictStore.test_append_with_new_variable[3] ______________ 1544s 1544s self = 1544s 1544s def test_append_with_new_variable(self) -> None: 1544s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1544s 1544s # check append mode for new variable 1544s with self.create_zarr_target() as store_target: 1544s combined = xr.concat([ds, ds_to_append], dim="time") 1544s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1544s assert_identical( 1544s combined, 1544s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'da' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_append_with_append_dim_no_overwrite[3] _________ 1544s 1544s self = 1544s 1544s def test_append_with_append_dim_no_overwrite(self) -> None: 1544s ds, ds_to_append, _ = create_append_test_data() 1544s with self.create_zarr_target() as store_target: 1544s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1544s original = xr.concat([ds, ds_to_append], dim="time") 1544s original2 = xr.concat([original, ds_to_append], dim="time") 1544s 1544s # overwrite a coordinate; 1544s # for mode='a-', this will not get written to the store 1544s # because it does not have the append_dim as a dim 1544s lon = ds_to_append.lon.to_numpy().copy() 1544s lon[:] = -999 1544s ds_to_append["lon"] = lon 1544s > ds_to_append.to_zarr( 1544s store_target, mode="a-", append_dim="time", **self.version_kwargs 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'da' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s __________ TestZarrDictStore.test_to_zarr_compute_false_roundtrip[3] ___________ 1544s 1544s self = 1544s 1544s @requires_dask 1544s def test_to_zarr_compute_false_roundtrip(self) -> None: 1544s from dask.delayed import Delayed 1544s 1544s original = create_test_data().chunk() 1544s 1544s with self.create_zarr_target() as store: 1544s delayed_obj = self.save(original, store, compute=False) 1544s assert isinstance(delayed_obj, Delayed) 1544s 1544s # make sure target store has not been written to yet 1544s with pytest.raises(AssertionError): 1544s > with self.open(store) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'dim2' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _______ TestZarrDictStore.test_to_zarr_append_compute_false_roundtrip[3] _______ 1544s 1544s self = 1544s 1544s @requires_dask 1544s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1544s from dask.delayed import Delayed 1544s 1544s ds, ds_to_append, _ = create_append_test_data() 1544s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1544s 1544s with pytest.warns(SerializationWarning): 1544s with self.create_zarr_target() as store: 1544s delayed_obj = self.save(ds, store, compute=False, mode="w") 1544s assert isinstance(delayed_obj, Delayed) 1544s 1544s with pytest.raises(AssertionError): 1544s > with self.open(store) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'da' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________________ TestZarrDictStore.test_save_emptydim[3-False] _________________ 1544s 1544s self = 1544s chunk = False 1544s 1544s @pytest.mark.parametrize("chunk", [False, True]) 1544s def test_save_emptydim(self, chunk) -> None: 1544s if chunk and not has_dask: 1544s pytest.skip("requires dask") 1544s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1544s if chunk: 1544s ds = ds.chunk({}) # chunk dataset to save dask array 1544s > with self.roundtrip(ds) as ds_reload: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________________ TestZarrDictStore.test_save_emptydim[3-True] _________________ 1544s 1544s self = 1544s chunk = True 1544s 1544s @pytest.mark.parametrize("chunk", [False, True]) 1544s def test_save_emptydim(self, chunk) -> None: 1544s if chunk and not has_dask: 1544s pytest.skip("requires dask") 1544s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1544s if chunk: 1544s ds = ds.chunk({}) # chunk dataset to save dask array 1544s > with self.roundtrip(ds) as ds_reload: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _____ TestZarrDictStore.test_no_warning_from_open_emptydim_with_chunks[3] ______ 1544s 1544s self = 1544s 1544s @requires_dask 1544s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1544s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1544s with assert_no_warnings(): 1544s with warnings.catch_warnings(): 1544s warnings.filterwarnings( 1544s "ignore", 1544s message=".*Zarr format 3 specification.*", 1544s category=UserWarning, 1544s ) 1544s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1544s with self.open(store_target, **open_kwargs) as ds: 1544s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1544s return next(self.gen) 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1544s with xr.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'x' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-False-False-False-False] ________ 1544s 1544s self = 1544s consolidated = False, compute = False, use_dask = False, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-False-False-False-True] _________ 1544s 1544s self = 1544s consolidated = True, compute = False, use_dask = False, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-False-False-False-None] _________ 1544s 1544s self = 1544s consolidated = None, compute = False, use_dask = False, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-False-False-True-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = True, use_dask = False, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-False-True-True] _________ 1544s 1544s self = 1544s consolidated = True, compute = True, use_dask = False, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-False-True-None] _________ 1544s 1544s self = 1544s consolidated = None, compute = True, use_dask = False, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-False-True-False-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = False, use_dask = True, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-True-False-True] _________ 1544s 1544s self = 1544s consolidated = True, compute = False, use_dask = True, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-True-False-None] _________ 1544s 1544s self = 1544s consolidated = None, compute = False, use_dask = True, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-True-True-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = True, use_dask = True, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-True-True-True] __________ 1544s 1544s self = 1544s consolidated = True, compute = True, use_dask = True, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-False-True-True-None] __________ 1544s 1544s self = 1544s consolidated = None, compute = True, use_dask = True, write_empty = False 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-True-False-False-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = False, use_dask = False, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-False-False-True] _________ 1544s 1544s self = 1544s consolidated = True, compute = False, use_dask = False, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-False-False-None] _________ 1544s 1544s self = 1544s consolidated = None, compute = False, use_dask = False, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-False-True-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = True, use_dask = False, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-False-True-True] __________ 1544s 1544s self = 1544s consolidated = True, compute = True, use_dask = False, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-False-True-None] __________ 1544s 1544s self = 1544s consolidated = None, compute = True, use_dask = False, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-True-False-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = False, use_dask = True, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-True-False-True] __________ 1544s 1544s self = 1544s consolidated = True, compute = False, use_dask = True, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-True-False-None] __________ 1544s 1544s self = 1544s consolidated = None, compute = False, use_dask = True, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-True-True-True-False] __________ 1544s 1544s self = 1544s consolidated = False, compute = True, use_dask = True, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s __________ TestZarrDictStore.test_write_region[3-True-True-True-True] __________ 1544s 1544s self = 1544s consolidated = True, compute = True, use_dask = True, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s __________ TestZarrDictStore.test_write_region[3-True-True-True-None] __________ 1544s 1544s self = 1544s consolidated = None, compute = True, use_dask = True, write_empty = True 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s > with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1544s ds = open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1544s backend_ds = backend.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1544s ds = store_entrypoint.open_dataset( 1544s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1544s vars, attrs = filename_or_obj.load() 1544s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1544s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1544s return Frozen(dict(*args, **kwargs)) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1544s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s ________ TestZarrDictStore.test_write_region[3-None-False-False-False] _________ 1544s 1544s self = 1544s consolidated = False, compute = False, use_dask = False, write_empty = None 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1544s if self._use_zarr_fill_value_as_mask: 1544s # Setting this attribute triggers CF decoding for missing values 1544s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1544s if zarr_array.fill_value is not None: 1544s attributes["_FillValue"] = zarr_array.fill_value 1544s elif "_FillValue" in attributes: 1544s original_zarr_dtype = zarr_array.metadata.data_type 1544s attributes["_FillValue"] = FillValueCoder.decode( 1544s > attributes["_FillValue"], original_zarr_dtype.value 1544s ) 1544s E AttributeError: 'Float64' object has no attribute 'value' 1544s 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1544s _________ TestZarrDictStore.test_write_region[3-None-False-False-True] _________ 1544s 1544s self = 1544s consolidated = True, compute = False, use_dask = False, write_empty = None 1544s 1544s @pytest.mark.parametrize("consolidated", [False, True, None]) 1544s @pytest.mark.parametrize("compute", [False, True]) 1544s @pytest.mark.parametrize("use_dask", [False, True]) 1544s @pytest.mark.parametrize("write_empty", [False, True, None]) 1544s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1544s if (use_dask or not compute) and not has_dask: 1544s pytest.skip("requires dask") 1544s 1544s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1544s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1544s 1544s if use_dask: 1544s zeros = zeros.chunk(2) 1544s nonzeros = nonzeros.chunk(2) 1544s 1544s with self.create_zarr_target() as store: 1544s zeros.to_zarr( 1544s store, 1544s consolidated=consolidated, 1544s compute=compute, 1544s encoding={"u": dict(chunks=2)}, 1544s **self.version_kwargs, 1544s ) 1544s if compute: 1544s with xr.open_zarr( 1544s store, consolidated=consolidated, **self.version_kwargs 1544s ) as actual: 1544s assert_identical(actual, zeros) 1544s for i in range(0, 10, 2): 1544s region = {"x": slice(i, i + 2)} 1544s > nonzeros.isel(region).to_zarr( 1544s store, 1544s region=region, 1544s consolidated=consolidated, 1544s write_empty_chunks=write_empty, 1544s **self.version_kwargs, 1544s ) 1544s 1544s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1544s return to_zarr( # type: ignore[call-overload,misc] 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1544s dump_to_store(dataset, zstore, writer, encoding=encoding) 1544s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1544s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1544s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1544s k: self.open_store_variable(name=k) for k in existing_variable_names 1544s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1544s 1544s self = , name = 'u' 1544s 1544s def open_store_variable(self, name): 1544s zarr_array = self.members[name] 1544s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1544s try_nczarr = self._mode == "r" 1544s dimensions, attributes = _get_zarr_dims_and_attrs( 1544s zarr_array, DIMENSION_KEY, try_nczarr 1544s ) 1544s attributes = dict(attributes) 1544s 1544s encoding = { 1544s "chunks": zarr_array.chunks, 1544s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1544s } 1544s 1544s if _zarr_v3(): 1544s encoding.update( 1544s { 1544s "compressors": zarr_array.compressors, 1544s "filters": zarr_array.filters, 1544s "shards": zarr_array.shards, 1544s } 1544s ) 1544s if self.zarr_group.metadata.zarr_format == 3: 1544s encoding.update({"serializer": zarr_array.serializer}) 1544s else: 1544s encoding.update( 1544s { 1544s "compressor": zarr_array.compressor, 1544s "filters": zarr_array.filters, 1544s } 1544s ) 1544s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-False-False-None] _________ 1545s 1545s self = 1545s consolidated = None, compute = False, use_dask = False, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s assert_identical(actual, zeros) 1545s for i in range(0, 10, 2): 1545s region = {"x": slice(i, i + 2)} 1545s > nonzeros.isel(region).to_zarr( 1545s store, 1545s region=region, 1545s consolidated=consolidated, 1545s write_empty_chunks=write_empty, 1545s **self.version_kwargs, 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-False-True-False] _________ 1545s 1545s self = 1545s consolidated = False, compute = True, use_dask = False, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s > with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-False-True-True] __________ 1545s 1545s self = 1545s consolidated = True, compute = True, use_dask = False, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s > with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-False-True-None] __________ 1545s 1545s self = 1545s consolidated = None, compute = True, use_dask = False, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s > with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-True-False-False] _________ 1545s 1545s self = 1545s consolidated = False, compute = False, use_dask = True, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s assert_identical(actual, zeros) 1545s for i in range(0, 10, 2): 1545s region = {"x": slice(i, i + 2)} 1545s > nonzeros.isel(region).to_zarr( 1545s store, 1545s region=region, 1545s consolidated=consolidated, 1545s write_empty_chunks=write_empty, 1545s **self.version_kwargs, 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-True-False-True] __________ 1545s 1545s self = 1545s consolidated = True, compute = False, use_dask = True, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s assert_identical(actual, zeros) 1545s for i in range(0, 10, 2): 1545s region = {"x": slice(i, i + 2)} 1545s > nonzeros.isel(region).to_zarr( 1545s store, 1545s region=region, 1545s consolidated=consolidated, 1545s write_empty_chunks=write_empty, 1545s **self.version_kwargs, 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-True-False-None] __________ 1545s 1545s self = 1545s consolidated = None, compute = False, use_dask = True, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s assert_identical(actual, zeros) 1545s for i in range(0, 10, 2): 1545s region = {"x": slice(i, i + 2)} 1545s > nonzeros.isel(region).to_zarr( 1545s store, 1545s region=region, 1545s consolidated=consolidated, 1545s write_empty_chunks=write_empty, 1545s **self.version_kwargs, 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDictStore.test_write_region[3-None-True-True-False] __________ 1545s 1545s self = 1545s consolidated = False, compute = True, use_dask = True, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s > with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________ TestZarrDictStore.test_write_region[3-None-True-True-True] __________ 1545s 1545s self = 1545s consolidated = True, compute = True, use_dask = True, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s > with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________ TestZarrDictStore.test_write_region[3-None-True-True-None] __________ 1545s 1545s self = 1545s consolidated = None, compute = True, use_dask = True, write_empty = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s @pytest.mark.parametrize("compute", [False, True]) 1545s @pytest.mark.parametrize("use_dask", [False, True]) 1545s @pytest.mark.parametrize("write_empty", [False, True, None]) 1545s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1545s if (use_dask or not compute) and not has_dask: 1545s pytest.skip("requires dask") 1545s 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s 1545s if use_dask: 1545s zeros = zeros.chunk(2) 1545s nonzeros = nonzeros.chunk(2) 1545s 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr( 1545s store, 1545s consolidated=consolidated, 1545s compute=compute, 1545s encoding={"u": dict(chunks=2)}, 1545s **self.version_kwargs, 1545s ) 1545s if compute: 1545s > with xr.open_zarr( 1545s store, consolidated=consolidated, **self.version_kwargs 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _______________ TestZarrDictStore.test_write_region_mode[3-None] _______________ 1545s 1545s self = 1545s mode = None 1545s 1545s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1545s def test_write_region_mode(self, mode) -> None: 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr(store, **self.version_kwargs) 1545s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1545s > nonzeros.isel(region).to_zarr( 1545s store, region=region, mode=mode, **self.version_kwargs 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________________ TestZarrDictStore.test_write_region_mode[3-r+] ________________ 1545s 1545s self = 1545s mode = 'r+' 1545s 1545s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1545s def test_write_region_mode(self, mode) -> None: 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr(store, **self.version_kwargs) 1545s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1545s > nonzeros.isel(region).to_zarr( 1545s store, region=region, mode=mode, **self.version_kwargs 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________________ TestZarrDictStore.test_write_region_mode[3-a] _________________ 1545s 1545s self = 1545s mode = 'a' 1545s 1545s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1545s def test_write_region_mode(self, mode) -> None: 1545s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1545s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1545s with self.create_zarr_target() as store: 1545s zeros.to_zarr(store, **self.version_kwargs) 1545s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1545s > nonzeros.isel(region).to_zarr( 1545s store, region=region, mode=mode, **self.version_kwargs 1545s ) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________ TestZarrDictStore.test_write_preexisting_override_metadata[3] _________ 1545s 1545s self = 1545s 1545s @requires_dask 1545s def test_write_preexisting_override_metadata(self) -> None: 1545s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1545s original = Dataset( 1545s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1545s attrs={"global": "original"}, 1545s ) 1545s both_modified = Dataset( 1545s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1545s attrs={"global": "modified"}, 1545s ) 1545s global_modified = Dataset( 1545s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1545s attrs={"global": "modified"}, 1545s ) 1545s only_new_data = Dataset( 1545s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1545s attrs={"global": "original"}, 1545s ) 1545s 1545s with self.create_zarr_target() as store: 1545s original.to_zarr(store, compute=False, **self.version_kwargs) 1545s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'u' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________________ TestZarrDictStore.test_encoding_chunksizes[3] _________________ 1545s 1545s self = 1545s 1545s @requires_dask 1545s def test_encoding_chunksizes(self) -> None: 1545s # regression test for GH2278 1545s # see also test_encoding_chunksizes_unlimited 1545s nx, ny, nt = 4, 4, 5 1545s original = xr.Dataset( 1545s {}, 1545s coords={ 1545s "x": np.arange(nx), 1545s "y": np.arange(ny), 1545s "t": np.arange(nt), 1545s }, 1545s ) 1545s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1545s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1545s 1545s > with self.roundtrip(original) as ds1: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'v' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______ TestZarrDictStore.test_chunk_encoding_with_partial_dask_chunks[3] _______ 1545s 1545s self = 1545s 1545s @requires_dask 1545s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1545s original = xr.Dataset( 1545s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1545s ).chunk({"a": 3}) 1545s 1545s > with self.roundtrip( 1545s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1545s ) as ds1: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________________ TestZarrDictStore.test_open_zarr_use_cftime[3] ________________ 1545s 1545s self = 1545s 1545s @requires_cftime 1545s def test_open_zarr_use_cftime(self) -> None: 1545s ds = create_test_data() 1545s with self.create_zarr_target() as store_target: 1545s ds.to_zarr(store_target, **self.version_kwargs) 1545s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDictStore.test_write_read_select_write[3] _______________ 1545s 1545s self = 1545s 1545s def test_write_read_select_write(self) -> None: 1545s # Test for https://github.com/pydata/xarray/issues/4084 1545s ds = create_test_data() 1545s 1545s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1545s with self.create_zarr_target() as initial_store: 1545s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1545s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________________ TestZarrDictStore.test_attributes[3-obj1] ___________________ 1545s 1545s self = 1545s obj = Size: 8B 1545s array(nan) 1545s Attributes: 1545s good: {'key': 'value'} 1545s 1545s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1545s def test_attributes(self, obj) -> None: 1545s obj = obj.copy() 1545s 1545s obj.attrs["good"] = {"key": "value"} 1545s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1545s with self.create_zarr_target() as store_target: 1545s ds.to_zarr(store_target, **self.version_kwargs) 1545s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'foo' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1545s 1545s self = 1545s dtype = 'datetime64[ns]' 1545s 1545s @requires_dask 1545s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1545s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1545s # Generalized from @malmans2's test in PR #8253 1545s original = create_test_data().astype(dtype).chunk(1) 1545s > with self.roundtrip( 1545s original, 1545s open_kwargs={ 1545s "chunks": {}, 1545s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1545s }, 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] __ 1545s 1545s self = 1545s dtype = 'timedelta64[ns]' 1545s 1545s @requires_dask 1545s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1545s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1545s # Generalized from @malmans2's test in PR #8253 1545s original = create_test_data().astype(dtype).chunk(1) 1545s > with self.roundtrip( 1545s original, 1545s open_kwargs={ 1545s "chunks": {}, 1545s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1545s }, 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ___________ TestZarrDictStore.test_zarr_fill_value_setting[3-float] ____________ 1545s 1545s self = 1545s dtype = 1545s 1545s @requires_dask 1545s @pytest.mark.parametrize("dtype", [int, float]) 1545s def test_zarr_fill_value_setting(self, dtype): 1545s # When zarr_format=2, _FillValue sets fill_value 1545s # When zarr_format=3, fill_value is set independently 1545s # We test this by writing a dask array with compute=False, 1545s # on read we should receive chunks filled with `fill_value` 1545s fv = -1 1545s ds = xr.Dataset( 1545s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1545s ) 1545s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1545s 1545s zarr_format_2 = ( 1545s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1545s ) or not has_zarr_v3 1545s if zarr_format_2: 1545s attr = "_FillValue" 1545s expected.foo.attrs[attr] = fv 1545s else: 1545s attr = "fill_value" 1545s if dtype is float: 1545s # for floats, Xarray inserts a default `np.nan` 1545s expected.foo.attrs["_FillValue"] = np.nan 1545s 1545s # turn off all decoding so we see what Zarr returns to us. 1545s # Since chunks, are not written, we should receive on `fill_value` 1545s open_kwargs = { 1545s "mask_and_scale": False, 1545s "consolidated": False, 1545s "use_zarr_fill_value_as_mask": False, 1545s } 1545s save_kwargs = dict(compute=False, consolidated=False) 1545s > with self.roundtrip( 1545s ds, 1545s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1545s open_kwargs=open_kwargs, 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'foo' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ___________ TestZarrDirectoryStore.test_zero_dimensional_variable[3] ___________ 1545s 1545s self = 1545s 1545s def test_zero_dimensional_variable(self) -> None: 1545s expected = create_test_data() 1545s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1545s expected["bytes_var"] = ([], b"foobar") 1545s expected["string_var"] = ([], "foobar") 1545s > with self.roundtrip(expected) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________________ TestZarrDirectoryStore.test_write_store[3] __________________ 1545s 1545s self = 1545s 1545s def test_write_store(self) -> None: 1545s expected = create_test_data() 1545s with self.create_store() as store: 1545s expected.dump_to_store(store) 1545s # we need to cf decode the store because it has time and 1545s # non-dimension coordinates 1545s > with xr.decode_cf(store) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1545s vars, attrs = obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'var3' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_roundtrip_test_data[3] ______________ 1545s 1545s self = 1545s 1545s def test_roundtrip_test_data(self) -> None: 1545s expected = create_test_data() 1545s > with self.roundtrip(expected) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _____________________ TestZarrDirectoryStore.test_load[3] ______________________ 1545s 1545s self = 1545s 1545s def test_load(self) -> None: 1545s expected = create_test_data() 1545s 1545s @contextlib.contextmanager 1545s def assert_loads(vars=None): 1545s if vars is None: 1545s vars = expected 1545s with self.roundtrip(expected) as actual: 1545s for k, v in actual.variables.items(): 1545s # IndexVariables are eagerly loaded into memory 1545s assert v._in_memory == (k in actual.dims) 1545s yield actual 1545s for k, v in actual.variables.items(): 1545s if k in vars: 1545s assert v._in_memory 1545s assert_identical(expected, actual) 1545s 1545s with pytest.raises(AssertionError): 1545s # make sure the contextmanager works! 1545s > with assert_loads() as ds: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1545s with self.roundtrip(expected) as actual: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________________ TestZarrDirectoryStore.test_dataset_compute[3] ________________ 1545s 1545s self = 1545s 1545s def test_dataset_compute(self) -> None: 1545s expected = create_test_data() 1545s 1545s > with self.roundtrip(expected) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ____________ TestZarrDirectoryStore.test_roundtrip_object_dtype[3] _____________ 1545s 1545s self = 1545s 1545s def test_roundtrip_object_dtype(self) -> None: 1545s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1545s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1545s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1545s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1545s strings = np.array(["ab", "cdef", "g"], dtype=object) 1545s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1545s all_nans = np.array([np.nan, np.nan], dtype=object) 1545s original = Dataset( 1545s { 1545s "floats": ("a", floats), 1545s "floats_nans": ("a", floats_nans), 1545s "bytes": ("b", bytes_), 1545s "bytes_nans": ("b", bytes_nans), 1545s "strings": ("b", strings), 1545s "strings_nans": ("b", strings_nans), 1545s "all_nans": ("c", all_nans), 1545s "nan": ([], np.nan), 1545s } 1545s ) 1545s expected = original.copy(deep=True) 1545s > with self.roundtrip(original) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'nan' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ____________ TestZarrDirectoryStore.test_roundtrip_float64_data[3] _____________ 1545s 1545s self = 1545s 1545s def test_roundtrip_float64_data(self) -> None: 1545s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1545s > with self.roundtrip(expected) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_orthogonal_indexing[3] ______________ 1545s 1545s self = 1545s 1545s def test_orthogonal_indexing(self) -> None: 1545s in_memory = create_test_data() 1545s > with self.roundtrip(in_memory) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_vectorized_indexing[3] ______________ 1545s 1545s self = 1545s 1545s def test_vectorized_indexing(self) -> None: 1545s in_memory = create_test_data() 1545s > with self.roundtrip(in_memory) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _______ TestZarrDirectoryStore.test_vectorized_indexing_negative_step[3] _______ 1545s 1545s self = 1545s 1545s def test_vectorized_indexing_negative_step(self) -> None: 1545s # use dask explicitly when present 1545s open_kwargs: dict[str, Any] | None 1545s if has_dask: 1545s open_kwargs = {"chunks": {}} 1545s else: 1545s open_kwargs = None 1545s in_memory = create_test_data() 1545s 1545s def multiple_indexing(indexers): 1545s # make sure a sequence of lazy indexings certainly works. 1545s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1545s actual = on_disk["var3"] 1545s expected = in_memory["var3"] 1545s for ind in indexers: 1545s actual = actual.isel(ind) 1545s expected = expected.isel(ind) 1545s # make sure the array is not yet loaded into memory 1545s assert not actual.variable._in_memory 1545s assert_identical(expected, actual.load()) 1545s 1545s # with negative step slice. 1545s indexers = [ 1545s { 1545s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1545s "dim3": slice(-1, 1, -1), 1545s } 1545s ] 1545s > multiple_indexing(indexers) 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1545s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ____________ TestZarrDirectoryStore.test_outer_indexing_reversed[3] ____________ 1545s 1545s self = 1545s 1545s def test_outer_indexing_reversed(self) -> None: 1545s # regression test for GH6560 1545s ds = xr.Dataset( 1545s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1545s ) 1545s 1545s > with self.roundtrip(ds) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'z' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________________ TestZarrDirectoryStore.test_isel_dataarray[3] _________________ 1545s 1545s self = 1545s 1545s def test_isel_dataarray(self) -> None: 1545s # Make sure isel works lazily. GH:issue:1688 1545s in_memory = create_test_data() 1545s > with self.roundtrip(in_memory) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ___________ TestZarrDirectoryStore.test_array_type_after_indexing[3] ___________ 1545s 1545s self = 1545s 1545s def test_array_type_after_indexing(self) -> None: 1545s in_memory = create_test_data() 1545s > with self.roundtrip(in_memory) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ____________________ TestZarrDirectoryStore.test_dropna[3] _____________________ 1545s 1545s self = 1545s 1545s def test_dropna(self) -> None: 1545s # regression test for GH:issue:1694 1545s a = np.random.randn(4, 3) 1545s a[1, 1] = np.nan 1545s in_memory = xr.Dataset( 1545s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1545s ) 1545s 1545s assert_identical( 1545s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1545s ) 1545s 1545s > with self.roundtrip(in_memory) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'a' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_ondisk_after_print[3] _______________ 1545s 1545s self = 1545s 1545s def test_ondisk_after_print(self) -> None: 1545s """Make sure print does not load file into memory""" 1545s in_memory = create_test_data() 1545s > with self.roundtrip(in_memory) as on_disk: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ________ TestZarrDirectoryStore.test_roundtrip_bytes_with_fill_value[3] ________ 1545s 1545s self = 1545s 1545s def test_roundtrip_bytes_with_fill_value(self) -> None: 1545s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1545s encoding = {"_FillValue": b"X", "dtype": "S1"} 1545s original = Dataset({"x": ("t", values, {}, encoding)}) 1545s expected = original.copy(deep=True) 1545s > with self.roundtrip(original) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _____ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value0-False] ______ 1545s 1545s self = 1545s fill_value = np.int8(-1), exp_fill_warning = False 1545s 1545s @pytest.mark.parametrize( 1545s ("fill_value", "exp_fill_warning"), 1545s [ 1545s (np.int8(-1), False), 1545s (np.uint8(255), True), 1545s (-1, False), 1545s (255, True), 1545s ], 1545s ) 1545s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1545s @contextlib.contextmanager 1545s def _roundtrip_with_warnings(*args, **kwargs): 1545s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1545s if exp_fill_warning and is_np2: 1545s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1545s SerializationWarning, 1545s match="_FillValue attribute can't be represented", 1545s ) 1545s else: 1545s warn_checker = contextlib.nullcontext() 1545s with warn_checker: 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s yield actual 1545s 1545s # regression/numpy2 test for 1545s encoding = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s "dtype": "i1", 1545s } 1545s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1545s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1545s 1545s attributes = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s } 1545s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1545s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1545s encoded = Dataset({"x": ("t", sb, attributes)}) 1545s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1545s 1545s > with _roundtrip_with_warnings(decoded) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Int8' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value1-True] ______ 1545s 1545s self = 1545s fill_value = np.uint8(255), exp_fill_warning = True 1545s 1545s @pytest.mark.parametrize( 1545s ("fill_value", "exp_fill_warning"), 1545s [ 1545s (np.int8(-1), False), 1545s (np.uint8(255), True), 1545s (-1, False), 1545s (255, True), 1545s ], 1545s ) 1545s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1545s @contextlib.contextmanager 1545s def _roundtrip_with_warnings(*args, **kwargs): 1545s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1545s if exp_fill_warning and is_np2: 1545s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1545s SerializationWarning, 1545s match="_FillValue attribute can't be represented", 1545s ) 1545s else: 1545s warn_checker = contextlib.nullcontext() 1545s with warn_checker: 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s yield actual 1545s 1545s # regression/numpy2 test for 1545s encoding = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s "dtype": "i1", 1545s } 1545s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1545s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1545s 1545s attributes = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s } 1545s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1545s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1545s encoded = Dataset({"x": ("t", sb, attributes)}) 1545s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1545s 1545s > with _roundtrip_with_warnings(decoded) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Int8' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3--1-False] __________ 1545s 1545s self = 1545s fill_value = -1, exp_fill_warning = False 1545s 1545s @pytest.mark.parametrize( 1545s ("fill_value", "exp_fill_warning"), 1545s [ 1545s (np.int8(-1), False), 1545s (np.uint8(255), True), 1545s (-1, False), 1545s (255, True), 1545s ], 1545s ) 1545s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1545s @contextlib.contextmanager 1545s def _roundtrip_with_warnings(*args, **kwargs): 1545s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1545s if exp_fill_warning and is_np2: 1545s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1545s SerializationWarning, 1545s match="_FillValue attribute can't be represented", 1545s ) 1545s else: 1545s warn_checker = contextlib.nullcontext() 1545s with warn_checker: 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s yield actual 1545s 1545s # regression/numpy2 test for 1545s encoding = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s "dtype": "i1", 1545s } 1545s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1545s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1545s 1545s attributes = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s } 1545s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1545s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1545s encoded = Dataset({"x": ("t", sb, attributes)}) 1545s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1545s 1545s > with _roundtrip_with_warnings(decoded) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Int8' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3-255-True] __________ 1545s 1545s self = 1545s fill_value = 255, exp_fill_warning = True 1545s 1545s @pytest.mark.parametrize( 1545s ("fill_value", "exp_fill_warning"), 1545s [ 1545s (np.int8(-1), False), 1545s (np.uint8(255), True), 1545s (-1, False), 1545s (255, True), 1545s ], 1545s ) 1545s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1545s @contextlib.contextmanager 1545s def _roundtrip_with_warnings(*args, **kwargs): 1545s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1545s if exp_fill_warning and is_np2: 1545s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1545s SerializationWarning, 1545s match="_FillValue attribute can't be represented", 1545s ) 1545s else: 1545s warn_checker = contextlib.nullcontext() 1545s with warn_checker: 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s yield actual 1545s 1545s # regression/numpy2 test for 1545s encoding = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s "dtype": "i1", 1545s } 1545s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1545s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1545s 1545s attributes = { 1545s "_FillValue": fill_value, 1545s "_Unsigned": "true", 1545s } 1545s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1545s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1545s encoded = Dataset({"x": ("t", sb, attributes)}) 1545s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1545s 1545s > with _roundtrip_with_warnings(decoded) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1545s with self.roundtrip(*args, **kwargs) as actual: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Int8' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1545s 1545s self = 1545s 1545s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1545s original = self._create_cf_dataset() 1545s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'det_lim' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _ TestZarrDirectoryStore.test_coordinate_variables_after_dataset_roundtrip[3] __ 1545s 1545s self = 1545s 1545s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1545s original = self._create_cf_dataset() 1545s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'det_lim' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1545s 1545s self = 1545s 1545s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1545s self, 1545s ) -> None: 1545s original = self._create_cf_dataset() 1545s # The DataArray roundtrip should have the same warnings as the 1545s # Dataset, but we already tested for those, so just go for the 1545s # new warnings. It would appear that there is no way to tell 1545s # pytest "This warning and also this warning should both be 1545s # present". 1545s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1545s # needs the to_dataset. The other backends should be fine 1545s # without it. 1545s with pytest.warns( 1545s UserWarning, 1545s match=( 1545s r"Variable\(s\) referenced in bounds not in variables: " 1545s r"\['l(at|ong)itude_bnds'\]" 1545s ), 1545s ): 1545s > with self.roundtrip( 1545s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'ln_p' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s 1545s During handling of the above exception, another exception occurred: 1545s 1545s self = 1545s 1545s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1545s self, 1545s ) -> None: 1545s original = self._create_cf_dataset() 1545s # The DataArray roundtrip should have the same warnings as the 1545s # Dataset, but we already tested for those, so just go for the 1545s # new warnings. It would appear that there is no way to tell 1545s # pytest "This warning and also this warning should both be 1545s # present". 1545s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1545s # needs the to_dataset. The other backends should be fine 1545s # without it. 1545s > with pytest.warns( 1545s UserWarning, 1545s match=( 1545s r"Variable\(s\) referenced in bounds not in variables: " 1545s r"\['l(at|ong)itude_bnds'\]" 1545s ), 1545s ): 1545s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1545s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1545s 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.')]. 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1545s ________________ TestZarrDirectoryStore.test_encoding_kwarg[3] _________________ 1545s 1545s self = 1545s 1545s def test_encoding_kwarg(self) -> None: 1545s ds = Dataset({"x": ("y", np.arange(10.0))}) 1545s 1545s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1545s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float32' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_default_fill_value[3] _______________ 1545s 1545s self = 1545s 1545s def test_default_fill_value(self) -> None: 1545s # Test default encoding for float: 1545s ds = Dataset({"x": ("y", np.arange(10.0))}) 1545s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1545s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float32' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord[3] ______ 1545s 1545s self = 1545s 1545s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1545s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1545s ds.y.encoding["_FillValue"] = None 1545s > with self.roundtrip(ds) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1545s 1545s self = 1545s 1545s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1545s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1545s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1545s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_encoding_same_dtype[3] ______________ 1545s 1545s self = 1545s 1545s def test_encoding_same_dtype(self) -> None: 1545s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1545s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1545s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'x' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float32' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ____________ TestZarrDirectoryStore.test_append_overwrite_values[3] ____________ 1545s 1545s self = 1545s 1545s def test_append_overwrite_values(self) -> None: 1545s # regression for GH1215 1545s data = create_test_data() 1545s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1545s self.save(data, tmp_file, mode="w") 1545s data["var2"][:] = -999 1545s data["var9"] = data["var2"] * 3 1545s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1545s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1545s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1545s return to_zarr( # type: ignore[call-overload,misc] 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1545s dump_to_store(dataset, zstore, writer, encoding=encoding) 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1545s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1545s k: self.open_store_variable(name=k) for k in existing_variable_names 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-False] __________ 1545s 1545s self = 1545s consolidated = False 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s def test_roundtrip_consolidated(self, consolidated) -> None: 1545s expected = create_test_data() 1545s > with self.roundtrip( 1545s expected, 1545s save_kwargs={"consolidated": consolidated}, 1545s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'var2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-True] __________ 1545s 1545s self = 1545s consolidated = True 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s def test_roundtrip_consolidated(self, consolidated) -> None: 1545s expected = create_test_data() 1545s > with self.roundtrip( 1545s expected, 1545s save_kwargs={"consolidated": consolidated}, 1545s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-None] __________ 1545s 1545s self = 1545s consolidated = None 1545s 1545s @pytest.mark.parametrize("consolidated", [False, True, None]) 1545s def test_roundtrip_consolidated(self, consolidated) -> None: 1545s expected = create_test_data() 1545s > with self.roundtrip( 1545s expected, 1545s save_kwargs={"consolidated": consolidated}, 1545s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1545s ) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________ TestZarrDirectoryStore.test_read_non_consolidated_warning[3] _________ 1545s 1545s self = 1545s 1545s def test_read_non_consolidated_warning(self) -> None: 1545s expected = create_test_data() 1545s with self.create_zarr_target() as store: 1545s self.save( 1545s expected, store_target=store, consolidated=False, **self.version_kwargs 1545s ) 1545s with pytest.warns( 1545s RuntimeWarning, 1545s match="Failed to open Zarr store with consolidated", 1545s ): 1545s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'var2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ______________ TestZarrDirectoryStore.test_non_existent_store[3] _______________ 1545s 1545s self = 1545s 1545s def test_non_existent_store(self) -> None: 1545s with pytest.raises( 1545s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1545s ): 1545s > xr.open_zarr(f"{uuid.uuid4()}") 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1545s ds = open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1545s store = ZarrStore.open_group( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1545s ) = _get_open_params( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1545s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1545s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1545s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1545s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1545s raise return_result 1545s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1545s return await coro 1545s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1545s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1545s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1545s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1545s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1545s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1545s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1545s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1545s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1545s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1545s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1545s await store._open() 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/3f7a97b9-bd9c-47f9-b85f-ae7026bb7039') 1545s 1545s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1545s if not self.read_only: 1545s self.root.mkdir(parents=True, exist_ok=True) 1545s 1545s if not self.root.exists(): 1545s > raise FileNotFoundError(f"{self.root} does not exist") 1545s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/3f7a97b9-bd9c-47f9-b85f-ae7026bb7039 does not exist 1545s 1545s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1545s 1545s During handling of the above exception, another exception occurred: 1545s 1545s self = 1545s 1545s def test_non_existent_store(self) -> None: 1545s > with pytest.raises( 1545s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1545s ): 1545s E AssertionError: Regex pattern did not match. 1545s E Regex: '(No such file or directory|Unable to find group)' 1545s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/3f7a97b9-bd9c-47f9-b85f-ae7026bb7039 does not exist' 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1545s __________________ TestZarrDirectoryStore.test_auto_chunk[3] ___________________ 1545s 1545s self = 1545s 1545s @requires_dask 1545s def test_auto_chunk(self) -> None: 1545s original = create_test_data().chunk() 1545s 1545s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _________________ TestZarrDirectoryStore.test_manual_chunk[3] __________________ 1545s 1545s self = 1545s 1545s @requires_dask 1545s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1545s def test_manual_chunk(self) -> None: 1545s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1545s 1545s # Using chunks = None should return non-chunked arrays 1545s open_kwargs: dict[str, Any] = {"chunks": None} 1545s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s _____________ TestZarrDirectoryStore.test_warning_on_bad_chunks[3] _____________ 1545s 1545s self = 1545s 1545s @requires_dask 1545s def test_warning_on_bad_chunks(self) -> None: 1545s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1545s 1545s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1545s for chunks in bad_chunks: 1545s kwargs = {"chunks": chunks} 1545s with pytest.warns(UserWarning): 1545s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1545s with self.open(store_target, **open_kwargs) as ds: 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1545s with xr.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1545s backend_ds = backend.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1545s ds = store_entrypoint.open_dataset( 1545s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1545s vars, attrs = filename_or_obj.load() 1545s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1545s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1545s return Frozen(dict(*args, **kwargs)) 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1545s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s 1545s self = , name = 'dim2' 1545s 1545s def open_store_variable(self, name): 1545s zarr_array = self.members[name] 1545s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1545s try_nczarr = self._mode == "r" 1545s dimensions, attributes = _get_zarr_dims_and_attrs( 1545s zarr_array, DIMENSION_KEY, try_nczarr 1545s ) 1545s attributes = dict(attributes) 1545s 1545s encoding = { 1545s "chunks": zarr_array.chunks, 1545s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1545s } 1545s 1545s if _zarr_v3(): 1545s encoding.update( 1545s { 1545s "compressors": zarr_array.compressors, 1545s "filters": zarr_array.filters, 1545s "shards": zarr_array.shards, 1545s } 1545s ) 1545s if self.zarr_group.metadata.zarr_format == 3: 1545s encoding.update({"serializer": zarr_array.serializer}) 1545s else: 1545s encoding.update( 1545s { 1545s "compressor": zarr_array.compressor, 1545s "filters": zarr_array.filters, 1545s } 1545s ) 1545s 1545s if self._use_zarr_fill_value_as_mask: 1545s # Setting this attribute triggers CF decoding for missing values 1545s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1545s if zarr_array.fill_value is not None: 1545s attributes["_FillValue"] = zarr_array.fill_value 1545s elif "_FillValue" in attributes: 1545s original_zarr_dtype = zarr_array.metadata.data_type 1545s attributes["_FillValue"] = FillValueCoder.decode( 1545s > attributes["_FillValue"], original_zarr_dtype.value 1545s ) 1545s E AttributeError: 'Float64' object has no attribute 'value' 1545s 1545s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1545s ___________ TestZarrDirectoryStore.test_write_uneven_dask_chunks[3] ____________ 1545s 1545s self = 1545s 1545s @requires_dask 1545s def test_write_uneven_dask_chunks(self) -> None: 1545s # regression for GH#2225 1545s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1545s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1545s 1545s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1545s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1545s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1545s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ________________ TestZarrDirectoryStore.test_chunk_encoding[3] _________________ 1546s 1546s self = 1546s 1546s def test_chunk_encoding(self) -> None: 1546s # These datasets have no dask chunks. All chunking specified in 1546s # encoding 1546s data = create_test_data() 1546s chunks = (5, 5) 1546s data["var2"].encoding.update({"chunks": chunks}) 1546s 1546s > with self.roundtrip(data) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ________________ TestZarrDirectoryStore.test_shard_encoding[3] _________________ 1546s 1546s self = 1546s 1546s def test_shard_encoding(self) -> None: 1546s # These datasets have no dask chunks. All chunking/sharding specified in 1546s # encoding 1546s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1546s data = create_test_data() 1546s chunks = (1, 1) 1546s shards = (5, 5) 1546s data["var2"].encoding.update({"chunks": chunks}) 1546s data["var2"].encoding.update({"shards": shards}) 1546s > with self.roundtrip(data) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _________ TestZarrDirectoryStore.test_write_persistence_modes[3-None] __________ 1546s 1546s self = 1546s group = None 1546s 1546s @pytest.mark.parametrize("group", [None, "group1"]) 1546s def test_write_persistence_modes(self, group) -> None: 1546s original = create_test_data() 1546s 1546s # overwrite mode 1546s > with self.roundtrip( 1546s original, 1546s save_kwargs={"mode": "w", "group": group}, 1546s open_kwargs={"group": group}, 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ________ TestZarrDirectoryStore.test_write_persistence_modes[3-group1] _________ 1546s 1546s self = 1546s group = 'group1' 1546s 1546s @pytest.mark.parametrize("group", [None, "group1"]) 1546s def test_write_persistence_modes(self, group) -> None: 1546s original = create_test_data() 1546s 1546s # overwrite mode 1546s > with self.roundtrip( 1546s original, 1546s save_kwargs={"mode": "w", "group": group}, 1546s open_kwargs={"group": group}, 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______________ TestZarrDirectoryStore.test_compressor_encoding[3] ______________ 1546s 1546s self = 1546s 1546s def test_compressor_encoding(self) -> None: 1546s # specify a custom compressor 1546s original = create_test_data() 1546s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1546s encoding_key = "compressors" 1546s # all parameters need to be explicitly specified in order for the comparison to pass below 1546s encoding = { 1546s "serializer": zarr.codecs.BytesCodec(endian="little"), 1546s encoding_key: ( 1546s zarr.codecs.BloscCodec( 1546s cname="zstd", 1546s clevel=3, 1546s shuffle="shuffle", 1546s typesize=8, 1546s blocksize=0, 1546s ), 1546s ), 1546s } 1546s else: 1546s from numcodecs.blosc import Blosc 1546s 1546s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1546s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1546s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1546s 1546s save_kwargs = dict(encoding={"var1": encoding}) 1546s 1546s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _____________________ TestZarrDirectoryStore.test_group[3] _____________________ 1546s 1546s self = 1546s 1546s def test_group(self) -> None: 1546s original = create_test_data() 1546s group = "some/random/path" 1546s > with self.roundtrip( 1546s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _________________ TestZarrDirectoryStore.test_append_write[3] __________________ 1546s 1546s self = 1546s 1546s def test_append_write(self) -> None: 1546s > super().test_append_write() 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1546s with self.roundtrip_append(data) as actual: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1546s self.save(data[[key]], path, mode=mode, **save_kwargs) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1546s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _____ TestZarrDirectoryStore.test_append_with_append_dim_not_set_raises[3] _____ 1546s 1546s self = 1546s 1546s def test_append_with_append_dim_not_set_raises(self) -> None: 1546s ds, ds_to_append, _ = create_append_test_data() 1546s with self.create_zarr_target() as store_target: 1546s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1546s with pytest.raises(ValueError, match="different dimension sizes"): 1546s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'da' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-U] _____ 1546s 1546s self = 1546s dtype = 'U' 1546s 1546s @pytest.mark.parametrize("dtype", ["U", "S"]) 1546s def test_append_string_length_mismatch_works(self, dtype) -> None: 1546s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1546s # ...but it probably would if we used object dtype 1546s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1546s expected = xr.concat([ds, ds_to_append], dim="time") 1546s with self.create_zarr_target() as store_target: 1546s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1546s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1546s _validate_datatypes_for_zarr_append( 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s vname = 'temperature' 1546s existing_var = Size: 24B 1546s [3 values with dtype= Size: 60B 1546s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1546s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1546s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1546s f"dataset to append has dtype {new_var.dtype}." 1546s ) 1546s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1546s dtype = 'S' 1546s 1546s @pytest.mark.parametrize("dtype", ["U", "S"]) 1546s def test_append_string_length_mismatch_works(self, dtype) -> None: 1546s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1546s # ...but it probably would if we used object dtype 1546s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1546s expected = xr.concat([ds, ds_to_append], dim="time") 1546s with self.create_zarr_target() as store_target: 1546s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1546s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1546s _validate_datatypes_for_zarr_append( 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s vname = 'temperature' 1546s existing_var = Size: 6B 1546s [3 values with dtype=|S2] 1546s new_var = Size: 9B 1546s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1546s 1546s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1546s """If variable exists in the store, confirm dtype of the data to append is compatible with 1546s existing dtype. 1546s """ 1546s if ( 1546s np.issubdtype(new_var.dtype, np.number) 1546s or np.issubdtype(new_var.dtype, np.datetime64) 1546s or np.issubdtype(new_var.dtype, np.bool_) 1546s or new_var.dtype == object 1546s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1546s ): 1546s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1546s # new to the dataset, because in this case there is no existing var to compare it to; 1546s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1546s # we can be confident appending won't cause problems. Examples of dtypes which are not 1546s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1546s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1546s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1546s f"dataset to append has dtype {new_var.dtype}." 1546s ) 1546s 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. 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1546s ___ TestZarrDirectoryStore.test_check_encoding_is_consistent_after_append[3] ___ 1546s 1546s self = 1546s 1546s def test_check_encoding_is_consistent_after_append(self) -> None: 1546s ds, ds_to_append, _ = create_append_test_data() 1546s 1546s # check encoding consistency 1546s with self.create_zarr_target() as store_target: 1546s import numcodecs 1546s 1546s encoding_value: Any 1546s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1546s compressor = zarr.codecs.BloscCodec() 1546s else: 1546s compressor = numcodecs.Blosc() 1546s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1546s encoding_value = (compressor,) if has_zarr_v3 else compressor 1546s 1546s encoding = {"da": {encoding_key: encoding_value}} 1546s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1546s > original_ds = xr.open_dataset( 1546s store_target, engine="zarr", **self.version_kwargs 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'da' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ___________ TestZarrDirectoryStore.test_append_with_new_variable[3] ____________ 1546s 1546s self = 1546s 1546s def test_append_with_new_variable(self) -> None: 1546s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1546s 1546s # check append mode for new variable 1546s with self.create_zarr_target() as store_target: 1546s combined = xr.concat([ds, ds_to_append], dim="time") 1546s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1546s assert_identical( 1546s combined, 1546s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'da' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_append_with_append_dim_no_overwrite[3] ______ 1546s 1546s self = 1546s 1546s def test_append_with_append_dim_no_overwrite(self) -> None: 1546s ds, ds_to_append, _ = create_append_test_data() 1546s with self.create_zarr_target() as store_target: 1546s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1546s original = xr.concat([ds, ds_to_append], dim="time") 1546s original2 = xr.concat([original, ds_to_append], dim="time") 1546s 1546s # overwrite a coordinate; 1546s # for mode='a-', this will not get written to the store 1546s # because it does not have the append_dim as a dim 1546s lon = ds_to_append.lon.to_numpy().copy() 1546s lon[:] = -999 1546s ds_to_append["lon"] = lon 1546s > ds_to_append.to_zarr( 1546s store_target, mode="a-", append_dim="time", **self.version_kwargs 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'da' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ________ TestZarrDirectoryStore.test_to_zarr_compute_false_roundtrip[3] ________ 1546s 1546s self = 1546s 1546s @requires_dask 1546s def test_to_zarr_compute_false_roundtrip(self) -> None: 1546s from dask.delayed import Delayed 1546s 1546s original = create_test_data().chunk() 1546s 1546s with self.create_zarr_target() as store: 1546s delayed_obj = self.save(original, store, compute=False) 1546s assert isinstance(delayed_obj, Delayed) 1546s 1546s # make sure target store has not been written to yet 1546s with pytest.raises(AssertionError): 1546s > with self.open(store) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'dim2' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ____ TestZarrDirectoryStore.test_to_zarr_append_compute_false_roundtrip[3] _____ 1546s 1546s self = 1546s 1546s @requires_dask 1546s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1546s from dask.delayed import Delayed 1546s 1546s ds, ds_to_append, _ = create_append_test_data() 1546s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1546s 1546s with pytest.warns(SerializationWarning): 1546s with self.create_zarr_target() as store: 1546s delayed_obj = self.save(ds, store, compute=False, mode="w") 1546s assert isinstance(delayed_obj, Delayed) 1546s 1546s with pytest.raises(AssertionError): 1546s > with self.open(store) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'da' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______________ TestZarrDirectoryStore.test_save_emptydim[3-False] ______________ 1546s 1546s self = 1546s chunk = False 1546s 1546s @pytest.mark.parametrize("chunk", [False, True]) 1546s def test_save_emptydim(self, chunk) -> None: 1546s if chunk and not has_dask: 1546s pytest.skip("requires dask") 1546s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1546s if chunk: 1546s ds = ds.chunk({}) # chunk dataset to save dask array 1546s > with self.roundtrip(ds) as ds_reload: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'x' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______________ TestZarrDirectoryStore.test_save_emptydim[3-True] _______________ 1546s 1546s self = 1546s chunk = True 1546s 1546s @pytest.mark.parametrize("chunk", [False, True]) 1546s def test_save_emptydim(self, chunk) -> None: 1546s if chunk and not has_dask: 1546s pytest.skip("requires dask") 1546s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1546s if chunk: 1546s ds = ds.chunk({}) # chunk dataset to save dask array 1546s > with self.roundtrip(ds) as ds_reload: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'x' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ___ TestZarrDirectoryStore.test_no_warning_from_open_emptydim_with_chunks[3] ___ 1546s 1546s self = 1546s 1546s @requires_dask 1546s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1546s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1546s with assert_no_warnings(): 1546s with warnings.catch_warnings(): 1546s warnings.filterwarnings( 1546s "ignore", 1546s message=".*Zarr format 3 specification.*", 1546s category=UserWarning, 1546s ) 1546s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1546s with self.open(store_target, **open_kwargs) as ds: 1546s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1546s return next(self.gen) 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1546s with xr.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'x' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _____ TestZarrDirectoryStore.test_write_region[3-False-False-False-False] ______ 1546s 1546s self = 1546s consolidated = False, compute = False, use_dask = False, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-True] ______ 1546s 1546s self = 1546s consolidated = True, compute = False, use_dask = False, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-None] ______ 1546s 1546s self = 1546s consolidated = None, compute = False, use_dask = False, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-False] ______ 1546s 1546s self = 1546s consolidated = False, compute = True, use_dask = False, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = True, use_dask = False, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = True, use_dask = False, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-False] ______ 1546s 1546s self = 1546s consolidated = False, compute = False, use_dask = True, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = False, use_dask = True, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = False, use_dask = True, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-False-True-True-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = True, use_dask = True, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = True, use_dask = True, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = True, use_dask = True, write_empty = False 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-False] ______ 1546s 1546s self = 1546s consolidated = False, compute = False, use_dask = False, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = False, use_dask = False, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = False, use_dask = False, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-True-False-True-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = True, use_dask = False, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = True, use_dask = False, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = True, use_dask = False, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-True-True-False-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = False, use_dask = True, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = False, use_dask = True, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = False, use_dask = True, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = True, use_dask = True, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-True] ________ 1546s 1546s self = 1546s consolidated = True, compute = True, use_dask = True, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-None] ________ 1546s 1546s self = 1546s consolidated = None, compute = True, use_dask = True, write_empty = True 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-False] ______ 1546s 1546s self = 1546s consolidated = False, compute = False, use_dask = False, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = False, use_dask = False, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = False, use_dask = False, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-None-False-True-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = True, use_dask = False, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = True, use_dask = False, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = True, use_dask = False, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_region[3-None-True-False-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = False, use_dask = True, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-True] _______ 1546s 1546s self = 1546s consolidated = True, compute = False, use_dask = True, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-None] _______ 1546s 1546s self = 1546s consolidated = None, compute = False, use_dask = True, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s assert_identical(actual, zeros) 1546s for i in range(0, 10, 2): 1546s region = {"x": slice(i, i + 2)} 1546s > nonzeros.isel(region).to_zarr( 1546s store, 1546s region=region, 1546s consolidated=consolidated, 1546s write_empty_chunks=write_empty, 1546s **self.version_kwargs, 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-False] _______ 1546s 1546s self = 1546s consolidated = False, compute = True, use_dask = True, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-True] ________ 1546s 1546s self = 1546s consolidated = True, compute = True, use_dask = True, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-None] ________ 1546s 1546s self = 1546s consolidated = None, compute = True, use_dask = True, write_empty = None 1546s 1546s @pytest.mark.parametrize("consolidated", [False, True, None]) 1546s @pytest.mark.parametrize("compute", [False, True]) 1546s @pytest.mark.parametrize("use_dask", [False, True]) 1546s @pytest.mark.parametrize("write_empty", [False, True, None]) 1546s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1546s if (use_dask or not compute) and not has_dask: 1546s pytest.skip("requires dask") 1546s 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s 1546s if use_dask: 1546s zeros = zeros.chunk(2) 1546s nonzeros = nonzeros.chunk(2) 1546s 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr( 1546s store, 1546s consolidated=consolidated, 1546s compute=compute, 1546s encoding={"u": dict(chunks=2)}, 1546s **self.version_kwargs, 1546s ) 1546s if compute: 1546s > with xr.open_zarr( 1546s store, consolidated=consolidated, **self.version_kwargs 1546s ) as actual: 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1546s ds = open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1546s backend_ds = backend.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1546s ds = store_entrypoint.open_dataset( 1546s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1546s vars, attrs = filename_or_obj.load() 1546s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1546s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1546s return Frozen(dict(*args, **kwargs)) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1546s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ____________ TestZarrDirectoryStore.test_write_region_mode[3-None] _____________ 1546s 1546s self = 1546s mode = None 1546s 1546s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1546s def test_write_region_mode(self, mode) -> None: 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr(store, **self.version_kwargs) 1546s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1546s > nonzeros.isel(region).to_zarr( 1546s store, region=region, mode=mode, **self.version_kwargs 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s _____________ TestZarrDirectoryStore.test_write_region_mode[3-r+] ______________ 1546s 1546s self = 1546s mode = 'r+' 1546s 1546s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1546s def test_write_region_mode(self, mode) -> None: 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr(store, **self.version_kwargs) 1546s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1546s > nonzeros.isel(region).to_zarr( 1546s store, region=region, mode=mode, **self.version_kwargs 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______________ TestZarrDirectoryStore.test_write_region_mode[3-a] ______________ 1546s 1546s self = 1546s mode = 'a' 1546s 1546s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1546s def test_write_region_mode(self, mode) -> None: 1546s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1546s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1546s with self.create_zarr_target() as store: 1546s zeros.to_zarr(store, **self.version_kwargs) 1546s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1546s > nonzeros.isel(region).to_zarr( 1546s store, region=region, mode=mode, **self.version_kwargs 1546s ) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1546s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1546s k: self.open_store_variable(name=k) for k in existing_variable_names 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s 1546s self = , name = 'u' 1546s 1546s def open_store_variable(self, name): 1546s zarr_array = self.members[name] 1546s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1546s try_nczarr = self._mode == "r" 1546s dimensions, attributes = _get_zarr_dims_and_attrs( 1546s zarr_array, DIMENSION_KEY, try_nczarr 1546s ) 1546s attributes = dict(attributes) 1546s 1546s encoding = { 1546s "chunks": zarr_array.chunks, 1546s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1546s } 1546s 1546s if _zarr_v3(): 1546s encoding.update( 1546s { 1546s "compressors": zarr_array.compressors, 1546s "filters": zarr_array.filters, 1546s "shards": zarr_array.shards, 1546s } 1546s ) 1546s if self.zarr_group.metadata.zarr_format == 3: 1546s encoding.update({"serializer": zarr_array.serializer}) 1546s else: 1546s encoding.update( 1546s { 1546s "compressor": zarr_array.compressor, 1546s "filters": zarr_array.filters, 1546s } 1546s ) 1546s 1546s if self._use_zarr_fill_value_as_mask: 1546s # Setting this attribute triggers CF decoding for missing values 1546s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1546s if zarr_array.fill_value is not None: 1546s attributes["_FillValue"] = zarr_array.fill_value 1546s elif "_FillValue" in attributes: 1546s original_zarr_dtype = zarr_array.metadata.data_type 1546s attributes["_FillValue"] = FillValueCoder.decode( 1546s > attributes["_FillValue"], original_zarr_dtype.value 1546s ) 1546s E AttributeError: 'Float64' object has no attribute 'value' 1546s 1546s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1546s ______ TestZarrDirectoryStore.test_write_preexisting_override_metadata[3] ______ 1546s 1546s self = 1546s 1546s @requires_dask 1546s def test_write_preexisting_override_metadata(self) -> None: 1546s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1546s original = Dataset( 1546s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1546s attrs={"global": "original"}, 1546s ) 1546s both_modified = Dataset( 1546s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1546s attrs={"global": "modified"}, 1546s ) 1546s global_modified = Dataset( 1546s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1546s attrs={"global": "modified"}, 1546s ) 1546s only_new_data = Dataset( 1546s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1546s attrs={"global": "original"}, 1546s ) 1546s 1546s with self.create_zarr_target() as store: 1546s original.to_zarr(store, compute=False, **self.version_kwargs) 1546s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1546s 1546s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1546s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1546s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1546s return to_zarr( # type: ignore[call-overload,misc] 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1546s dump_to_store(dataset, zstore, writer, encoding=encoding) 1546s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1547s k: self.open_store_variable(name=k) for k in existing_variable_names 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'u' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______________ TestZarrDirectoryStore.test_encoding_chunksizes[3] ______________ 1547s 1547s self = 1547s 1547s @requires_dask 1547s def test_encoding_chunksizes(self) -> None: 1547s # regression test for GH2278 1547s # see also test_encoding_chunksizes_unlimited 1547s nx, ny, nt = 4, 4, 5 1547s original = xr.Dataset( 1547s {}, 1547s coords={ 1547s "x": np.arange(nx), 1547s "y": np.arange(ny), 1547s "t": np.arange(nt), 1547s }, 1547s ) 1547s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1547s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1547s 1547s > with self.roundtrip(original) as ds1: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'v' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____ TestZarrDirectoryStore.test_chunk_encoding_with_partial_dask_chunks[3] ____ 1547s 1547s self = 1547s 1547s @requires_dask 1547s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1547s original = xr.Dataset( 1547s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1547s ).chunk({"a": 3}) 1547s 1547s > with self.roundtrip( 1547s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1547s ) as ds1: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _____________ TestZarrDirectoryStore.test_open_zarr_use_cftime[3] ______________ 1547s 1547s self = 1547s 1547s @requires_cftime 1547s def test_open_zarr_use_cftime(self) -> None: 1547s ds = create_test_data() 1547s with self.create_zarr_target() as store_target: 1547s ds.to_zarr(store_target, **self.version_kwargs) 1547s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1547s ds = open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____________ TestZarrDirectoryStore.test_write_read_select_write[3] ____________ 1547s 1547s self = 1547s 1547s def test_write_read_select_write(self) -> None: 1547s # Test for https://github.com/pydata/xarray/issues/4084 1547s ds = create_test_data() 1547s 1547s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1547s with self.create_zarr_target() as initial_store: 1547s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1547s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1547s ds = open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrDirectoryStore.test_attributes[3-obj1] ________________ 1547s 1547s self = 1547s obj = Size: 8B 1547s array(nan) 1547s Attributes: 1547s good: {'key': 'value'} 1547s 1547s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1547s def test_attributes(self, obj) -> None: 1547s obj = obj.copy() 1547s 1547s obj.attrs["good"] = {"key": "value"} 1547s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1547s with self.create_zarr_target() as store_target: 1547s ds.to_zarr(store_target, **self.version_kwargs) 1547s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1547s ds = open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'foo' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] _ 1547s 1547s self = 1547s dtype = 'datetime64[ns]' 1547s 1547s @requires_dask 1547s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1547s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1547s # Generalized from @malmans2's test in PR #8253 1547s original = create_test_data().astype(dtype).chunk(1) 1547s > with self.roundtrip( 1547s original, 1547s open_kwargs={ 1547s "chunks": {}, 1547s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1547s }, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1547s 1547s self = 1547s dtype = 'timedelta64[ns]' 1547s 1547s @requires_dask 1547s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1547s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1547s # Generalized from @malmans2's test in PR #8253 1547s original = create_test_data().astype(dtype).chunk(1) 1547s > with self.roundtrip( 1547s original, 1547s open_kwargs={ 1547s "chunks": {}, 1547s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1547s }, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _________ TestZarrDirectoryStore.test_zarr_fill_value_setting[3-float] _________ 1547s 1547s self = 1547s dtype = 1547s 1547s @requires_dask 1547s @pytest.mark.parametrize("dtype", [int, float]) 1547s def test_zarr_fill_value_setting(self, dtype): 1547s # When zarr_format=2, _FillValue sets fill_value 1547s # When zarr_format=3, fill_value is set independently 1547s # We test this by writing a dask array with compute=False, 1547s # on read we should receive chunks filled with `fill_value` 1547s fv = -1 1547s ds = xr.Dataset( 1547s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1547s ) 1547s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1547s 1547s zarr_format_2 = ( 1547s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1547s ) or not has_zarr_v3 1547s if zarr_format_2: 1547s attr = "_FillValue" 1547s expected.foo.attrs[attr] = fv 1547s else: 1547s attr = "fill_value" 1547s if dtype is float: 1547s # for floats, Xarray inserts a default `np.nan` 1547s expected.foo.attrs["_FillValue"] = np.nan 1547s 1547s # turn off all decoding so we see what Zarr returns to us. 1547s # Since chunks, are not written, we should receive on `fill_value` 1547s open_kwargs = { 1547s "mask_and_scale": False, 1547s "consolidated": False, 1547s "use_zarr_fill_value_as_mask": False, 1547s } 1547s save_kwargs = dict(compute=False, consolidated=False) 1547s > with self.roundtrip( 1547s ds, 1547s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1547s open_kwargs=open_kwargs, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'foo' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _____________ TestZarrWriteEmpty.test_zero_dimensional_variable[3] _____________ 1547s 1547s self = 1547s 1547s def test_zero_dimensional_variable(self) -> None: 1547s expected = create_test_data() 1547s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1547s expected["bytes_var"] = ([], b"foobar") 1547s expected["string_var"] = ([], "foobar") 1547s > with self.roundtrip(expected) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____________________ TestZarrWriteEmpty.test_write_store[3] ____________________ 1547s 1547s self = 1547s 1547s def test_write_store(self) -> None: 1547s expected = create_test_data() 1547s with self.create_store() as store: 1547s expected.dump_to_store(store) 1547s # we need to cf decode the store because it has time and 1547s # non-dimension coordinates 1547s > with xr.decode_cf(store) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1547s vars, attrs = obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'var1' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_roundtrip_test_data[3] ________________ 1547s 1547s self = 1547s 1547s def test_roundtrip_test_data(self) -> None: 1547s expected = create_test_data() 1547s > with self.roundtrip(expected) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _______________________ TestZarrWriteEmpty.test_load[3] ________________________ 1547s 1547s self = 1547s 1547s def test_load(self) -> None: 1547s expected = create_test_data() 1547s 1547s @contextlib.contextmanager 1547s def assert_loads(vars=None): 1547s if vars is None: 1547s vars = expected 1547s with self.roundtrip(expected) as actual: 1547s for k, v in actual.variables.items(): 1547s # IndexVariables are eagerly loaded into memory 1547s assert v._in_memory == (k in actual.dims) 1547s yield actual 1547s for k, v in actual.variables.items(): 1547s if k in vars: 1547s assert v._in_memory 1547s assert_identical(expected, actual) 1547s 1547s with pytest.raises(AssertionError): 1547s # make sure the contextmanager works! 1547s > with assert_loads() as ds: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1547s with self.roundtrip(expected) as actual: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________________ TestZarrWriteEmpty.test_dataset_compute[3] __________________ 1547s 1547s self = 1547s 1547s def test_dataset_compute(self) -> None: 1547s expected = create_test_data() 1547s 1547s > with self.roundtrip(expected) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______________ TestZarrWriteEmpty.test_roundtrip_object_dtype[3] _______________ 1547s 1547s self = 1547s 1547s def test_roundtrip_object_dtype(self) -> None: 1547s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1547s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1547s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1547s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1547s strings = np.array(["ab", "cdef", "g"], dtype=object) 1547s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1547s all_nans = np.array([np.nan, np.nan], dtype=object) 1547s original = Dataset( 1547s { 1547s "floats": ("a", floats), 1547s "floats_nans": ("a", floats_nans), 1547s "bytes": ("b", bytes_), 1547s "bytes_nans": ("b", bytes_nans), 1547s "strings": ("b", strings), 1547s "strings_nans": ("b", strings_nans), 1547s "all_nans": ("c", all_nans), 1547s "nan": ([], np.nan), 1547s } 1547s ) 1547s expected = original.copy(deep=True) 1547s > with self.roundtrip(original) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'nan' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______________ TestZarrWriteEmpty.test_roundtrip_float64_data[3] _______________ 1547s 1547s self = 1547s 1547s def test_roundtrip_float64_data(self) -> None: 1547s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1547s > with self.roundtrip(expected) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_orthogonal_indexing[3] ________________ 1547s 1547s self = 1547s 1547s def test_orthogonal_indexing(self) -> None: 1547s in_memory = create_test_data() 1547s > with self.roundtrip(in_memory) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_vectorized_indexing[3] ________________ 1547s 1547s self = 1547s 1547s def test_vectorized_indexing(self) -> None: 1547s in_memory = create_test_data() 1547s > with self.roundtrip(in_memory) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _________ TestZarrWriteEmpty.test_vectorized_indexing_negative_step[3] _________ 1547s 1547s self = 1547s 1547s def test_vectorized_indexing_negative_step(self) -> None: 1547s # use dask explicitly when present 1547s open_kwargs: dict[str, Any] | None 1547s if has_dask: 1547s open_kwargs = {"chunks": {}} 1547s else: 1547s open_kwargs = None 1547s in_memory = create_test_data() 1547s 1547s def multiple_indexing(indexers): 1547s # make sure a sequence of lazy indexings certainly works. 1547s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1547s actual = on_disk["var3"] 1547s expected = in_memory["var3"] 1547s for ind in indexers: 1547s actual = actual.isel(ind) 1547s expected = expected.isel(ind) 1547s # make sure the array is not yet loaded into memory 1547s assert not actual.variable._in_memory 1547s assert_identical(expected, actual.load()) 1547s 1547s # with negative step slice. 1547s indexers = [ 1547s { 1547s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1547s "dim3": slice(-1, 1, -1), 1547s } 1547s ] 1547s > multiple_indexing(indexers) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1547s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______________ TestZarrWriteEmpty.test_outer_indexing_reversed[3] ______________ 1547s 1547s self = 1547s 1547s def test_outer_indexing_reversed(self) -> None: 1547s # regression test for GH6560 1547s ds = xr.Dataset( 1547s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1547s ) 1547s 1547s > with self.roundtrip(ds) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'z' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________________ TestZarrWriteEmpty.test_isel_dataarray[3] ___________________ 1547s 1547s self = 1547s 1547s def test_isel_dataarray(self) -> None: 1547s # Make sure isel works lazily. GH:issue:1688 1547s in_memory = create_test_data() 1547s > with self.roundtrip(in_memory) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _____________ TestZarrWriteEmpty.test_array_type_after_indexing[3] _____________ 1547s 1547s self = 1547s 1547s def test_array_type_after_indexing(self) -> None: 1547s in_memory = create_test_data() 1547s > with self.roundtrip(in_memory) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______________________ TestZarrWriteEmpty.test_dropna[3] _______________________ 1547s 1547s self = 1547s 1547s def test_dropna(self) -> None: 1547s # regression test for GH:issue:1694 1547s a = np.random.randn(4, 3) 1547s a[1, 1] = np.nan 1547s in_memory = xr.Dataset( 1547s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1547s ) 1547s 1547s assert_identical( 1547s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1547s ) 1547s 1547s > with self.roundtrip(in_memory) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'a' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_ondisk_after_print[3] _________________ 1547s 1547s self = 1547s 1547s def test_ondisk_after_print(self) -> None: 1547s """Make sure print does not load file into memory""" 1547s in_memory = create_test_data() 1547s > with self.roundtrip(in_memory) as on_disk: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________ TestZarrWriteEmpty.test_roundtrip_bytes_with_fill_value[3] __________ 1547s 1547s self = 1547s 1547s def test_roundtrip_bytes_with_fill_value(self) -> None: 1547s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1547s encoding = {"_FillValue": b"X", "dtype": "S1"} 1547s original = Dataset({"x": ("t", values, {}, encoding)}) 1547s expected = original.copy(deep=True) 1547s > with self.roundtrip(original) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _______ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value0-False] ________ 1547s 1547s self = 1547s fill_value = np.int8(-1), exp_fill_warning = False 1547s 1547s @pytest.mark.parametrize( 1547s ("fill_value", "exp_fill_warning"), 1547s [ 1547s (np.int8(-1), False), 1547s (np.uint8(255), True), 1547s (-1, False), 1547s (255, True), 1547s ], 1547s ) 1547s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1547s @contextlib.contextmanager 1547s def _roundtrip_with_warnings(*args, **kwargs): 1547s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1547s if exp_fill_warning and is_np2: 1547s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1547s SerializationWarning, 1547s match="_FillValue attribute can't be represented", 1547s ) 1547s else: 1547s warn_checker = contextlib.nullcontext() 1547s with warn_checker: 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s yield actual 1547s 1547s # regression/numpy2 test for 1547s encoding = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s "dtype": "i1", 1547s } 1547s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1547s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1547s 1547s attributes = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s } 1547s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1547s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1547s encoded = Dataset({"x": ("t", sb, attributes)}) 1547s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1547s 1547s > with _roundtrip_with_warnings(decoded) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Int8' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value1-True] ________ 1547s 1547s self = 1547s fill_value = np.uint8(255), exp_fill_warning = True 1547s 1547s @pytest.mark.parametrize( 1547s ("fill_value", "exp_fill_warning"), 1547s [ 1547s (np.int8(-1), False), 1547s (np.uint8(255), True), 1547s (-1, False), 1547s (255, True), 1547s ], 1547s ) 1547s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1547s @contextlib.contextmanager 1547s def _roundtrip_with_warnings(*args, **kwargs): 1547s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1547s if exp_fill_warning and is_np2: 1547s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1547s SerializationWarning, 1547s match="_FillValue attribute can't be represented", 1547s ) 1547s else: 1547s warn_checker = contextlib.nullcontext() 1547s with warn_checker: 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s yield actual 1547s 1547s # regression/numpy2 test for 1547s encoding = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s "dtype": "i1", 1547s } 1547s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1547s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1547s 1547s attributes = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s } 1547s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1547s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1547s encoded = Dataset({"x": ("t", sb, attributes)}) 1547s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1547s 1547s > with _roundtrip_with_warnings(decoded) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Int8' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3--1-False] ____________ 1547s 1547s self = 1547s fill_value = -1, exp_fill_warning = False 1547s 1547s @pytest.mark.parametrize( 1547s ("fill_value", "exp_fill_warning"), 1547s [ 1547s (np.int8(-1), False), 1547s (np.uint8(255), True), 1547s (-1, False), 1547s (255, True), 1547s ], 1547s ) 1547s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1547s @contextlib.contextmanager 1547s def _roundtrip_with_warnings(*args, **kwargs): 1547s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1547s if exp_fill_warning and is_np2: 1547s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1547s SerializationWarning, 1547s match="_FillValue attribute can't be represented", 1547s ) 1547s else: 1547s warn_checker = contextlib.nullcontext() 1547s with warn_checker: 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s yield actual 1547s 1547s # regression/numpy2 test for 1547s encoding = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s "dtype": "i1", 1547s } 1547s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1547s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1547s 1547s attributes = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s } 1547s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1547s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1547s encoded = Dataset({"x": ("t", sb, attributes)}) 1547s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1547s 1547s > with _roundtrip_with_warnings(decoded) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Int8' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-255-True] ____________ 1547s 1547s self = 1547s fill_value = 255, exp_fill_warning = True 1547s 1547s @pytest.mark.parametrize( 1547s ("fill_value", "exp_fill_warning"), 1547s [ 1547s (np.int8(-1), False), 1547s (np.uint8(255), True), 1547s (-1, False), 1547s (255, True), 1547s ], 1547s ) 1547s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1547s @contextlib.contextmanager 1547s def _roundtrip_with_warnings(*args, **kwargs): 1547s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1547s if exp_fill_warning and is_np2: 1547s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1547s SerializationWarning, 1547s match="_FillValue attribute can't be represented", 1547s ) 1547s else: 1547s warn_checker = contextlib.nullcontext() 1547s with warn_checker: 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s yield actual 1547s 1547s # regression/numpy2 test for 1547s encoding = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s "dtype": "i1", 1547s } 1547s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1547s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1547s 1547s attributes = { 1547s "_FillValue": fill_value, 1547s "_Unsigned": "true", 1547s } 1547s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1547s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1547s encoded = Dataset({"x": ("t", sb, attributes)}) 1547s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1547s 1547s > with _roundtrip_with_warnings(decoded) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1547s with self.roundtrip(*args, **kwargs) as actual: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Int8' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1547s 1547s self = 1547s 1547s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1547s original = self._create_cf_dataset() 1547s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'det_lim' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ___ TestZarrWriteEmpty.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1547s 1547s self = 1547s 1547s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1547s original = self._create_cf_dataset() 1547s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'det_lim' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1547s 1547s self = 1547s 1547s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1547s self, 1547s ) -> None: 1547s original = self._create_cf_dataset() 1547s # The DataArray roundtrip should have the same warnings as the 1547s # Dataset, but we already tested for those, so just go for the 1547s # new warnings. It would appear that there is no way to tell 1547s # pytest "This warning and also this warning should both be 1547s # present". 1547s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1547s # needs the to_dataset. The other backends should be fine 1547s # without it. 1547s with pytest.warns( 1547s UserWarning, 1547s match=( 1547s r"Variable\(s\) referenced in bounds not in variables: " 1547s r"\['l(at|ong)itude_bnds'\]" 1547s ), 1547s ): 1547s > with self.roundtrip( 1547s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'ln_p' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s 1547s During handling of the above exception, another exception occurred: 1547s 1547s self = 1547s 1547s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1547s self, 1547s ) -> None: 1547s original = self._create_cf_dataset() 1547s # The DataArray roundtrip should have the same warnings as the 1547s # Dataset, but we already tested for those, so just go for the 1547s # new warnings. It would appear that there is no way to tell 1547s # pytest "This warning and also this warning should both be 1547s # present". 1547s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1547s # needs the to_dataset. The other backends should be fine 1547s # without it. 1547s > with pytest.warns( 1547s UserWarning, 1547s match=( 1547s r"Variable\(s\) referenced in bounds not in variables: " 1547s r"\['l(at|ong)itude_bnds'\]" 1547s ), 1547s ): 1547s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1547s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1547s 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.')]. 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1547s __________________ TestZarrWriteEmpty.test_encoding_kwarg[3] ___________________ 1547s 1547s self = 1547s 1547s def test_encoding_kwarg(self) -> None: 1547s ds = Dataset({"x": ("y", np.arange(10.0))}) 1547s 1547s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1547s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float32' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_default_fill_value[3] _________________ 1547s 1547s self = 1547s 1547s def test_default_fill_value(self) -> None: 1547s # Test default encoding for float: 1547s ds = Dataset({"x": ("y", np.arange(10.0))}) 1547s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1547s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float32' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord[3] ________ 1547s 1547s self = 1547s 1547s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1547s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1547s ds.y.encoding["_FillValue"] = None 1547s > with self.roundtrip(ds) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1547s 1547s self = 1547s 1547s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1547s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1547s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1547s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_encoding_same_dtype[3] ________________ 1547s 1547s self = 1547s 1547s def test_encoding_same_dtype(self) -> None: 1547s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1547s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1547s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'x' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float32' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______________ TestZarrWriteEmpty.test_append_overwrite_values[3] ______________ 1547s 1547s self = 1547s 1547s def test_append_overwrite_values(self) -> None: 1547s # regression for GH1215 1547s data = create_test_data() 1547s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1547s self.save(data, tmp_file, mode="w") 1547s data["var2"][:] = -999 1547s data["var9"] = data["var2"] * 3 1547s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1547s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1547s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1547s return to_zarr( # type: ignore[call-overload,misc] 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1547s dump_to_store(dataset, zstore, writer, encoding=encoding) 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1547s k: self.open_store_variable(name=k) for k in existing_variable_names 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ___________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-False] ____________ 1547s 1547s self = 1547s consolidated = False 1547s 1547s @pytest.mark.parametrize("consolidated", [False, True, None]) 1547s def test_roundtrip_consolidated(self, consolidated) -> None: 1547s expected = create_test_data() 1547s > with self.roundtrip( 1547s expected, 1547s save_kwargs={"consolidated": consolidated}, 1547s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'var3' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-True] ____________ 1547s 1547s self = 1547s consolidated = True 1547s 1547s @pytest.mark.parametrize("consolidated", [False, True, None]) 1547s def test_roundtrip_consolidated(self, consolidated) -> None: 1547s expected = create_test_data() 1547s > with self.roundtrip( 1547s expected, 1547s save_kwargs={"consolidated": consolidated}, 1547s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-None] ____________ 1547s 1547s self = 1547s consolidated = None 1547s 1547s @pytest.mark.parametrize("consolidated", [False, True, None]) 1547s def test_roundtrip_consolidated(self, consolidated) -> None: 1547s expected = create_test_data() 1547s > with self.roundtrip( 1547s expected, 1547s save_kwargs={"consolidated": consolidated}, 1547s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ___________ TestZarrWriteEmpty.test_read_non_consolidated_warning[3] ___________ 1547s 1547s self = 1547s 1547s def test_read_non_consolidated_warning(self) -> None: 1547s expected = create_test_data() 1547s with self.create_zarr_target() as store: 1547s self.save( 1547s expected, store_target=store, consolidated=False, **self.version_kwargs 1547s ) 1547s with pytest.warns( 1547s RuntimeWarning, 1547s match="Failed to open Zarr store with consolidated", 1547s ): 1547s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1547s ds = open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_non_existent_store[3] _________________ 1547s 1547s self = 1547s 1547s def test_non_existent_store(self) -> None: 1547s with pytest.raises( 1547s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1547s ): 1547s > xr.open_zarr(f"{uuid.uuid4()}") 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1547s ds = open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1547s store = ZarrStore.open_group( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1547s ) = _get_open_params( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1547s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1547s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1547s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1547s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1547s raise return_result 1547s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1547s return await coro 1547s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1547s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1547s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1547s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1547s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1547s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1547s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1547s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1547s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1547s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1547s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1547s await store._open() 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/22d6be2e-97b6-4885-b619-1b9c42b3cc61') 1547s 1547s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1547s if not self.read_only: 1547s self.root.mkdir(parents=True, exist_ok=True) 1547s 1547s if not self.root.exists(): 1547s > raise FileNotFoundError(f"{self.root} does not exist") 1547s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/22d6be2e-97b6-4885-b619-1b9c42b3cc61 does not exist 1547s 1547s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1547s 1547s During handling of the above exception, another exception occurred: 1547s 1547s self = 1547s 1547s def test_non_existent_store(self) -> None: 1547s > with pytest.raises( 1547s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1547s ): 1547s E AssertionError: Regex pattern did not match. 1547s E Regex: '(No such file or directory|Unable to find group)' 1547s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/22d6be2e-97b6-4885-b619-1b9c42b3cc61 does not exist' 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1547s ____________________ TestZarrWriteEmpty.test_auto_chunk[3] _____________________ 1547s 1547s self = 1547s 1547s @requires_dask 1547s def test_auto_chunk(self) -> None: 1547s original = create_test_data().chunk() 1547s 1547s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ___________________ TestZarrWriteEmpty.test_manual_chunk[3] ____________________ 1547s 1547s self = 1547s 1547s @requires_dask 1547s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1547s def test_manual_chunk(self) -> None: 1547s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1547s 1547s # Using chunks = None should return non-chunked arrays 1547s open_kwargs: dict[str, Any] = {"chunks": None} 1547s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _______________ TestZarrWriteEmpty.test_warning_on_bad_chunks[3] _______________ 1547s 1547s self = 1547s 1547s @requires_dask 1547s def test_warning_on_bad_chunks(self) -> None: 1547s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1547s 1547s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1547s for chunks in bad_chunks: 1547s kwargs = {"chunks": chunks} 1547s with pytest.warns(UserWarning): 1547s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _____________ TestZarrWriteEmpty.test_write_uneven_dask_chunks[3] ______________ 1547s 1547s self = 1547s 1547s @requires_dask 1547s def test_write_uneven_dask_chunks(self) -> None: 1547s # regression for GH#2225 1547s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1547s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________________ TestZarrWriteEmpty.test_chunk_encoding[3] ___________________ 1547s 1547s self = 1547s 1547s def test_chunk_encoding(self) -> None: 1547s # These datasets have no dask chunks. All chunking specified in 1547s # encoding 1547s data = create_test_data() 1547s chunks = (5, 5) 1547s data["var2"].encoding.update({"chunks": chunks}) 1547s 1547s > with self.roundtrip(data) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________________ TestZarrWriteEmpty.test_shard_encoding[3] ___________________ 1547s 1547s self = 1547s 1547s def test_shard_encoding(self) -> None: 1547s # These datasets have no dask chunks. All chunking/sharding specified in 1547s # encoding 1547s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1547s data = create_test_data() 1547s chunks = (1, 1) 1547s shards = (5, 5) 1547s data["var2"].encoding.update({"chunks": chunks}) 1547s data["var2"].encoding.update({"shards": shards}) 1547s > with self.roundtrip(data) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ___________ TestZarrWriteEmpty.test_write_persistence_modes[3-None] ____________ 1547s 1547s self = 1547s group = None 1547s 1547s @pytest.mark.parametrize("group", [None, "group1"]) 1547s def test_write_persistence_modes(self, group) -> None: 1547s original = create_test_data() 1547s 1547s # overwrite mode 1547s > with self.roundtrip( 1547s original, 1547s save_kwargs={"mode": "w", "group": group}, 1547s open_kwargs={"group": group}, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________ TestZarrWriteEmpty.test_write_persistence_modes[3-group1] ___________ 1547s 1547s self = 1547s group = 'group1' 1547s 1547s @pytest.mark.parametrize("group", [None, "group1"]) 1547s def test_write_persistence_modes(self, group) -> None: 1547s original = create_test_data() 1547s 1547s # overwrite mode 1547s > with self.roundtrip( 1547s original, 1547s save_kwargs={"mode": "w", "group": group}, 1547s open_kwargs={"group": group}, 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________________ TestZarrWriteEmpty.test_compressor_encoding[3] ________________ 1547s 1547s self = 1547s 1547s def test_compressor_encoding(self) -> None: 1547s # specify a custom compressor 1547s original = create_test_data() 1547s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1547s encoding_key = "compressors" 1547s # all parameters need to be explicitly specified in order for the comparison to pass below 1547s encoding = { 1547s "serializer": zarr.codecs.BytesCodec(endian="little"), 1547s encoding_key: ( 1547s zarr.codecs.BloscCodec( 1547s cname="zstd", 1547s clevel=3, 1547s shuffle="shuffle", 1547s typesize=8, 1547s blocksize=0, 1547s ), 1547s ), 1547s } 1547s else: 1547s from numcodecs.blosc import Blosc 1547s 1547s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1547s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1547s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1547s 1547s save_kwargs = dict(encoding={"var1": encoding}) 1547s 1547s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _______________________ TestZarrWriteEmpty.test_group[3] _______________________ 1547s 1547s self = 1547s 1547s def test_group(self) -> None: 1547s original = create_test_data() 1547s group = "some/random/path" 1547s > with self.roundtrip( 1547s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1547s ) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1547s with self.open(store_target, **open_kwargs) as ds: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ___________________ TestZarrWriteEmpty.test_append_write[3] ____________________ 1547s 1547s self = 1547s 1547s def test_append_write(self) -> None: 1547s > super().test_append_write() 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1547s with self.roundtrip_append(data) as actual: 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1547s self.save(data[[key]], path, mode=mode, **save_kwargs) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1547s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1547s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1547s return to_zarr( # type: ignore[call-overload,misc] 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1547s dump_to_store(dataset, zstore, writer, encoding=encoding) 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1547s k: self.open_store_variable(name=k) for k in existing_variable_names 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _______ TestZarrWriteEmpty.test_append_with_append_dim_not_set_raises[3] _______ 1547s 1547s self = 1547s 1547s def test_append_with_append_dim_not_set_raises(self) -> None: 1547s ds, ds_to_append, _ = create_append_test_data() 1547s with self.create_zarr_target() as store_target: 1547s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1547s with pytest.raises(ValueError, match="different dimension sizes"): 1547s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1547s return to_zarr( # type: ignore[call-overload,misc] 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1547s dump_to_store(dataset, zstore, writer, encoding=encoding) 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1547s k: self.open_store_variable(name=k) for k in existing_variable_names 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'da' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-U] _______ 1547s 1547s self = 1547s dtype = 'U' 1547s 1547s @pytest.mark.parametrize("dtype", ["U", "S"]) 1547s def test_append_string_length_mismatch_works(self, dtype) -> None: 1547s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1547s # ...but it probably would if we used object dtype 1547s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1547s expected = xr.concat([ds, ds_to_append], dim="time") 1547s with self.create_zarr_target() as store_target: 1547s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1547s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1547s return to_zarr( # type: ignore[call-overload,misc] 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1547s dump_to_store(dataset, zstore, writer, encoding=encoding) 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1547s _validate_datatypes_for_zarr_append( 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s vname = 'temperature' 1547s existing_var = Size: 24B 1547s [3 values with dtype= Size: 60B 1547s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1547s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1547s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1547s f"dataset to append has dtype {new_var.dtype}." 1547s ) 1547s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1547s dtype = 'S' 1547s 1547s @pytest.mark.parametrize("dtype", ["U", "S"]) 1547s def test_append_string_length_mismatch_works(self, dtype) -> None: 1547s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1547s # ...but it probably would if we used object dtype 1547s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1547s expected = xr.concat([ds, ds_to_append], dim="time") 1547s with self.create_zarr_target() as store_target: 1547s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1547s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1547s return to_zarr( # type: ignore[call-overload,misc] 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1547s dump_to_store(dataset, zstore, writer, encoding=encoding) 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1547s _validate_datatypes_for_zarr_append( 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s vname = 'temperature' 1547s existing_var = Size: 6B 1547s [3 values with dtype=|S2] 1547s new_var = Size: 9B 1547s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1547s 1547s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1547s """If variable exists in the store, confirm dtype of the data to append is compatible with 1547s existing dtype. 1547s """ 1547s if ( 1547s np.issubdtype(new_var.dtype, np.number) 1547s or np.issubdtype(new_var.dtype, np.datetime64) 1547s or np.issubdtype(new_var.dtype, np.bool_) 1547s or new_var.dtype == object 1547s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1547s ): 1547s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1547s # new to the dataset, because in this case there is no existing var to compare it to; 1547s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1547s # we can be confident appending won't cause problems. Examples of dtypes which are not 1547s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1547s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1547s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1547s f"dataset to append has dtype {new_var.dtype}." 1547s ) 1547s 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. 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1547s _____ TestZarrWriteEmpty.test_check_encoding_is_consistent_after_append[3] _____ 1547s 1547s self = 1547s 1547s def test_check_encoding_is_consistent_after_append(self) -> None: 1547s ds, ds_to_append, _ = create_append_test_data() 1547s 1547s # check encoding consistency 1547s with self.create_zarr_target() as store_target: 1547s import numcodecs 1547s 1547s encoding_value: Any 1547s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1547s compressor = zarr.codecs.BloscCodec() 1547s else: 1547s compressor = numcodecs.Blosc() 1547s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1547s encoding_value = (compressor,) if has_zarr_v3 else compressor 1547s 1547s encoding = {"da": {encoding_key: encoding_value}} 1547s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1547s > original_ds = xr.open_dataset( 1547s store_target, engine="zarr", **self.version_kwargs 1547s ) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'da' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s _____________ TestZarrWriteEmpty.test_append_with_new_variable[3] ______________ 1547s 1547s self = 1547s 1547s def test_append_with_new_variable(self) -> None: 1547s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1547s 1547s # check append mode for new variable 1547s with self.create_zarr_target() as store_target: 1547s combined = xr.concat([ds, ds_to_append], dim="time") 1547s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1547s assert_identical( 1547s combined, 1547s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1547s ) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'da' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ________ TestZarrWriteEmpty.test_append_with_append_dim_no_overwrite[3] ________ 1547s 1547s self = 1547s 1547s def test_append_with_append_dim_no_overwrite(self) -> None: 1547s ds, ds_to_append, _ = create_append_test_data() 1547s with self.create_zarr_target() as store_target: 1547s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1547s original = xr.concat([ds, ds_to_append], dim="time") 1547s original2 = xr.concat([original, ds_to_append], dim="time") 1547s 1547s # overwrite a coordinate; 1547s # for mode='a-', this will not get written to the store 1547s # because it does not have the append_dim as a dim 1547s lon = ds_to_append.lon.to_numpy().copy() 1547s lon[:] = -999 1547s ds_to_append["lon"] = lon 1547s > ds_to_append.to_zarr( 1547s store_target, mode="a-", append_dim="time", **self.version_kwargs 1547s ) 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1547s return to_zarr( # type: ignore[call-overload,misc] 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1547s dump_to_store(dataset, zstore, writer, encoding=encoding) 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1547s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1547s k: self.open_store_variable(name=k) for k in existing_variable_names 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'da' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s __________ TestZarrWriteEmpty.test_to_zarr_compute_false_roundtrip[3] __________ 1547s 1547s self = 1547s 1547s @requires_dask 1547s def test_to_zarr_compute_false_roundtrip(self) -> None: 1547s from dask.delayed import Delayed 1547s 1547s original = create_test_data().chunk() 1547s 1547s with self.create_zarr_target() as store: 1547s delayed_obj = self.save(original, store, compute=False) 1547s assert isinstance(delayed_obj, Delayed) 1547s 1547s # make sure target store has not been written to yet 1547s with pytest.raises(AssertionError): 1547s > with self.open(store) as actual: 1547s 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1547s return next(self.gen) 1547s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1547s with xr.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1547s backend_ds = backend.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1547s ds = store_entrypoint.open_dataset( 1547s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1547s vars, attrs = filename_or_obj.load() 1547s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1547s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1547s return Frozen(dict(*args, **kwargs)) 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1547s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1547s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1547s 1547s self = , name = 'dim2' 1547s 1547s def open_store_variable(self, name): 1547s zarr_array = self.members[name] 1547s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1547s try_nczarr = self._mode == "r" 1547s dimensions, attributes = _get_zarr_dims_and_attrs( 1547s zarr_array, DIMENSION_KEY, try_nczarr 1547s ) 1547s attributes = dict(attributes) 1547s 1547s encoding = { 1547s "chunks": zarr_array.chunks, 1547s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1547s } 1547s 1547s if _zarr_v3(): 1547s encoding.update( 1547s { 1547s "compressors": zarr_array.compressors, 1547s "filters": zarr_array.filters, 1547s "shards": zarr_array.shards, 1547s } 1547s ) 1547s if self.zarr_group.metadata.zarr_format == 3: 1547s encoding.update({"serializer": zarr_array.serializer}) 1547s else: 1547s encoding.update( 1547s { 1547s "compressor": zarr_array.compressor, 1547s "filters": zarr_array.filters, 1547s } 1547s ) 1547s 1547s if self._use_zarr_fill_value_as_mask: 1547s # Setting this attribute triggers CF decoding for missing values 1547s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1547s if zarr_array.fill_value is not None: 1547s attributes["_FillValue"] = zarr_array.fill_value 1547s elif "_FillValue" in attributes: 1547s original_zarr_dtype = zarr_array.metadata.data_type 1547s attributes["_FillValue"] = FillValueCoder.decode( 1547s > attributes["_FillValue"], original_zarr_dtype.value 1547s ) 1547s E AttributeError: 'Float64' object has no attribute 'value' 1547s 1547s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1547s ______ TestZarrWriteEmpty.test_to_zarr_append_compute_false_roundtrip[3] _______ 1547s 1548s self = 1548s 1548s @requires_dask 1548s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1548s from dask.delayed import Delayed 1548s 1548s ds, ds_to_append, _ = create_append_test_data() 1548s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1548s 1548s with pytest.warns(SerializationWarning): 1548s with self.create_zarr_target() as store: 1548s delayed_obj = self.save(ds, store, compute=False, mode="w") 1548s assert isinstance(delayed_obj, Delayed) 1548s 1548s with pytest.raises(AssertionError): 1548s > with self.open(store) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'da' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________________ TestZarrWriteEmpty.test_save_emptydim[3-False] ________________ 1548s 1548s self = 1548s chunk = False 1548s 1548s @pytest.mark.parametrize("chunk", [False, True]) 1548s def test_save_emptydim(self, chunk) -> None: 1548s if chunk and not has_dask: 1548s pytest.skip("requires dask") 1548s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1548s if chunk: 1548s ds = ds.chunk({}) # chunk dataset to save dask array 1548s > with self.roundtrip(ds) as ds_reload: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'x' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________________ TestZarrWriteEmpty.test_save_emptydim[3-True] _________________ 1548s 1548s self = 1548s chunk = True 1548s 1548s @pytest.mark.parametrize("chunk", [False, True]) 1548s def test_save_emptydim(self, chunk) -> None: 1548s if chunk and not has_dask: 1548s pytest.skip("requires dask") 1548s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1548s if chunk: 1548s ds = ds.chunk({}) # chunk dataset to save dask array 1548s > with self.roundtrip(ds) as ds_reload: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'x' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _____ TestZarrWriteEmpty.test_no_warning_from_open_emptydim_with_chunks[3] _____ 1548s 1548s self = 1548s 1548s @requires_dask 1548s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1548s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1548s with assert_no_warnings(): 1548s with warnings.catch_warnings(): 1548s warnings.filterwarnings( 1548s "ignore", 1548s message=".*Zarr format 3 specification.*", 1548s category=UserWarning, 1548s ) 1548s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'x' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _______ TestZarrWriteEmpty.test_write_region[3-False-False-False-False] ________ 1548s 1548s self = 1548s consolidated = False, compute = False, use_dask = False, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-True] ________ 1548s 1548s self = 1548s consolidated = True, compute = False, use_dask = False, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-None] ________ 1548s 1548s self = 1548s consolidated = None, compute = False, use_dask = False, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-False] ________ 1548s 1548s self = 1548s consolidated = False, compute = True, use_dask = False, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = True, use_dask = False, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = True, use_dask = False, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-False] ________ 1548s 1548s self = 1548s consolidated = False, compute = False, use_dask = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = False, use_dask = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = False, use_dask = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-False-True-True-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = True, use_dask = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = True, use_dask = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = True, use_dask = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-False] ________ 1548s 1548s self = 1548s consolidated = False, compute = False, use_dask = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = False, use_dask = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = False, use_dask = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-True-False-True-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = True, use_dask = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = True, use_dask = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = True, use_dask = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-True-True-False-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = False, use_dask = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = False, use_dask = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = False, use_dask = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = True, use_dask = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-True] __________ 1548s 1548s self = 1548s consolidated = True, compute = True, use_dask = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-None] __________ 1548s 1548s self = 1548s consolidated = None, compute = True, use_dask = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-False] ________ 1548s 1548s self = 1548s consolidated = False, compute = False, use_dask = False, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = False, use_dask = False, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = False, use_dask = False, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-None-False-True-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = True, use_dask = False, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = True, use_dask = False, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = True, use_dask = False, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_region[3-None-True-False-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = False, use_dask = True, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-True] _________ 1548s 1548s self = 1548s consolidated = True, compute = False, use_dask = True, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-None] _________ 1548s 1548s self = 1548s consolidated = None, compute = False, use_dask = True, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s assert_identical(actual, zeros) 1548s for i in range(0, 10, 2): 1548s region = {"x": slice(i, i + 2)} 1548s > nonzeros.isel(region).to_zarr( 1548s store, 1548s region=region, 1548s consolidated=consolidated, 1548s write_empty_chunks=write_empty, 1548s **self.version_kwargs, 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-False] _________ 1548s 1548s self = 1548s consolidated = False, compute = True, use_dask = True, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-True] __________ 1548s 1548s self = 1548s consolidated = True, compute = True, use_dask = True, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-None] __________ 1548s 1548s self = 1548s consolidated = None, compute = True, use_dask = True, write_empty = None 1548s 1548s @pytest.mark.parametrize("consolidated", [False, True, None]) 1548s @pytest.mark.parametrize("compute", [False, True]) 1548s @pytest.mark.parametrize("use_dask", [False, True]) 1548s @pytest.mark.parametrize("write_empty", [False, True, None]) 1548s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1548s if (use_dask or not compute) and not has_dask: 1548s pytest.skip("requires dask") 1548s 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s 1548s if use_dask: 1548s zeros = zeros.chunk(2) 1548s nonzeros = nonzeros.chunk(2) 1548s 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr( 1548s store, 1548s consolidated=consolidated, 1548s compute=compute, 1548s encoding={"u": dict(chunks=2)}, 1548s **self.version_kwargs, 1548s ) 1548s if compute: 1548s > with xr.open_zarr( 1548s store, consolidated=consolidated, **self.version_kwargs 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ______________ TestZarrWriteEmpty.test_write_region_mode[3-None] _______________ 1548s 1548s self = 1548s mode = None 1548s 1548s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1548s def test_write_region_mode(self, mode) -> None: 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr(store, **self.version_kwargs) 1548s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1548s > nonzeros.isel(region).to_zarr( 1548s store, region=region, mode=mode, **self.version_kwargs 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _______________ TestZarrWriteEmpty.test_write_region_mode[3-r+] ________________ 1548s 1548s self = 1548s mode = 'r+' 1548s 1548s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1548s def test_write_region_mode(self, mode) -> None: 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr(store, **self.version_kwargs) 1548s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1548s > nonzeros.isel(region).to_zarr( 1548s store, region=region, mode=mode, **self.version_kwargs 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________________ TestZarrWriteEmpty.test_write_region_mode[3-a] ________________ 1548s 1548s self = 1548s mode = 'a' 1548s 1548s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1548s def test_write_region_mode(self, mode) -> None: 1548s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1548s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1548s with self.create_zarr_target() as store: 1548s zeros.to_zarr(store, **self.version_kwargs) 1548s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1548s > nonzeros.isel(region).to_zarr( 1548s store, region=region, mode=mode, **self.version_kwargs 1548s ) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________ TestZarrWriteEmpty.test_write_preexisting_override_metadata[3] ________ 1548s 1548s self = 1548s 1548s @requires_dask 1548s def test_write_preexisting_override_metadata(self) -> None: 1548s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1548s original = Dataset( 1548s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1548s attrs={"global": "original"}, 1548s ) 1548s both_modified = Dataset( 1548s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1548s attrs={"global": "modified"}, 1548s ) 1548s global_modified = Dataset( 1548s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1548s attrs={"global": "modified"}, 1548s ) 1548s only_new_data = Dataset( 1548s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1548s attrs={"global": "original"}, 1548s ) 1548s 1548s with self.create_zarr_target() as store: 1548s original.to_zarr(store, compute=False, **self.version_kwargs) 1548s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'u' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ________________ TestZarrWriteEmpty.test_encoding_chunksizes[3] ________________ 1548s 1548s self = 1548s 1548s @requires_dask 1548s def test_encoding_chunksizes(self) -> None: 1548s # regression test for GH2278 1548s # see also test_encoding_chunksizes_unlimited 1548s nx, ny, nt = 4, 4, 5 1548s original = xr.Dataset( 1548s {}, 1548s coords={ 1548s "x": np.arange(nx), 1548s "y": np.arange(ny), 1548s "t": np.arange(nt), 1548s }, 1548s ) 1548s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1548s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1548s 1548s > with self.roundtrip(original) as ds1: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'v' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ______ TestZarrWriteEmpty.test_chunk_encoding_with_partial_dask_chunks[3] ______ 1548s 1548s self = 1548s 1548s @requires_dask 1548s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1548s original = xr.Dataset( 1548s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1548s ).chunk({"a": 3}) 1548s 1548s > with self.roundtrip( 1548s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1548s ) as ds1: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'x' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _______________ TestZarrWriteEmpty.test_open_zarr_use_cftime[3] ________________ 1548s 1548s self = 1548s 1548s @requires_cftime 1548s def test_open_zarr_use_cftime(self) -> None: 1548s ds = create_test_data() 1548s with self.create_zarr_target() as store_target: 1548s ds.to_zarr(store_target, **self.version_kwargs) 1548s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'dim2' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ______________ TestZarrWriteEmpty.test_write_read_select_write[3] ______________ 1548s 1548s self = 1548s 1548s def test_write_read_select_write(self) -> None: 1548s # Test for https://github.com/pydata/xarray/issues/4084 1548s ds = create_test_data() 1548s 1548s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1548s with self.create_zarr_target() as initial_store: 1548s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1548s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'dim2' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s __________________ TestZarrWriteEmpty.test_attributes[3-obj1] __________________ 1548s 1548s self = 1548s obj = Size: 8B 1548s array(nan) 1548s Attributes: 1548s good: {'key': 'value'} 1548s 1548s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1548s def test_attributes(self, obj) -> None: 1548s obj = obj.copy() 1548s 1548s obj.attrs["good"] = {"key": "value"} 1548s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1548s with self.create_zarr_target() as store_target: 1548s ds.to_zarr(store_target, **self.version_kwargs) 1548s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1548s ds = open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'foo' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1548s 1548s self = 1548s dtype = 'datetime64[ns]' 1548s 1548s @requires_dask 1548s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1548s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1548s # Generalized from @malmans2's test in PR #8253 1548s original = create_test_data().astype(dtype).chunk(1) 1548s > with self.roundtrip( 1548s original, 1548s open_kwargs={ 1548s "chunks": {}, 1548s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1548s }, 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'dim2' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1548s 1548s self = 1548s dtype = 'timedelta64[ns]' 1548s 1548s @requires_dask 1548s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1548s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1548s # Generalized from @malmans2's test in PR #8253 1548s original = create_test_data().astype(dtype).chunk(1) 1548s > with self.roundtrip( 1548s original, 1548s open_kwargs={ 1548s "chunks": {}, 1548s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1548s }, 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'dim2' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ___________ TestZarrWriteEmpty.test_zarr_fill_value_setting[3-float] ___________ 1548s 1548s self = 1548s dtype = 1548s 1548s @requires_dask 1548s @pytest.mark.parametrize("dtype", [int, float]) 1548s def test_zarr_fill_value_setting(self, dtype): 1548s # When zarr_format=2, _FillValue sets fill_value 1548s # When zarr_format=3, fill_value is set independently 1548s # We test this by writing a dask array with compute=False, 1548s # on read we should receive chunks filled with `fill_value` 1548s fv = -1 1548s ds = xr.Dataset( 1548s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1548s ) 1548s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1548s 1548s zarr_format_2 = ( 1548s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1548s ) or not has_zarr_v3 1548s if zarr_format_2: 1548s attr = "_FillValue" 1548s expected.foo.attrs[attr] = fv 1548s else: 1548s attr = "fill_value" 1548s if dtype is float: 1548s # for floats, Xarray inserts a default `np.nan` 1548s expected.foo.attrs["_FillValue"] = np.nan 1548s 1548s # turn off all decoding so we see what Zarr returns to us. 1548s # Since chunks, are not written, we should receive on `fill_value` 1548s open_kwargs = { 1548s "mask_and_scale": False, 1548s "consolidated": False, 1548s "use_zarr_fill_value_as_mask": False, 1548s } 1548s save_kwargs = dict(compute=False, consolidated=False) 1548s > with self.roundtrip( 1548s ds, 1548s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1548s open_kwargs=open_kwargs, 1548s ) as actual: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1548s with self.open(store_target, **open_kwargs) as ds: 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1548s with xr.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1548s backend_ds = backend.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1548s ds = store_entrypoint.open_dataset( 1548s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1548s vars, attrs = filename_or_obj.load() 1548s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1548s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1548s return Frozen(dict(*args, **kwargs)) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1548s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'foo' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _______________ TestZarrWriteEmpty.test_write_empty[3-True-True] _______________ 1548s 1548s self = 1548s consolidated = True, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [True, False, None]) 1548s @pytest.mark.parametrize("write_empty", [True, False, None]) 1548s def test_write_empty( 1548s self, 1548s consolidated: bool | None, 1548s write_empty: bool | None, 1548s ) -> None: 1548s def assert_expected_files(expected: list[str], store: str) -> None: 1548s """Convenience for comparing with actual files written""" 1548s ls = [] 1548s test_root = os.path.join(store, "test") 1548s for root, _, files in os.walk(test_root): 1548s ls.extend( 1548s [ 1548s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1548s for f in files 1548s ] 1548s ) 1548s 1548s assert set(expected) == set( 1548s [ 1548s file.lstrip("c/") 1548s for file in ls 1548s if (file not in (".zattrs", ".zarray", "zarr.json")) 1548s ] 1548s ) 1548s 1548s # The zarr format is set by the `default_zarr_format` 1548s # pytest fixture that acts on a superclass 1548s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1548s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1548s expected = ["0.1.0"] 1548s else: 1548s expected = [ 1548s "0.0.0", 1548s "0.0.1", 1548s "0.1.0", 1548s "0.1.1", 1548s ] 1548s 1548s if zarr_format_3: 1548s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1548s # transform to the path style of zarr 3 1548s # e.g. 0/0/1 1548s expected = [e.replace(".", "/") for e in expected] 1548s else: 1548s # use nan for default fill_value behaviour 1548s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1548s 1548s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1548s 1548s if has_dask: 1548s ds["test"] = ds["test"].chunk(1) 1548s encoding = None 1548s else: 1548s encoding = {"test": {"chunks": (1, 1, 1)}} 1548s 1548s with self.temp_dir() as (d, store): 1548s ds.to_zarr( 1548s store, 1548s mode="w", 1548s encoding=encoding, 1548s write_empty_chunks=write_empty, 1548s ) 1548s 1548s # check expected files after a write 1548s assert_expected_files(expected, store) 1548s 1548s > with self.roundtrip_dir( 1548s ds, 1548s store, 1548s save_kwargs={ 1548s "mode": "a", 1548s "append_dim": "Z", 1548s "write_empty_chunks": write_empty, 1548s }, 1548s ) as a_ds: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1548s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'test' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ______________ TestZarrWriteEmpty.test_write_empty[3-True-False] _______________ 1548s 1548s self = 1548s consolidated = False, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [True, False, None]) 1548s @pytest.mark.parametrize("write_empty", [True, False, None]) 1548s def test_write_empty( 1548s self, 1548s consolidated: bool | None, 1548s write_empty: bool | None, 1548s ) -> None: 1548s def assert_expected_files(expected: list[str], store: str) -> None: 1548s """Convenience for comparing with actual files written""" 1548s ls = [] 1548s test_root = os.path.join(store, "test") 1548s for root, _, files in os.walk(test_root): 1548s ls.extend( 1548s [ 1548s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1548s for f in files 1548s ] 1548s ) 1548s 1548s assert set(expected) == set( 1548s [ 1548s file.lstrip("c/") 1548s for file in ls 1548s if (file not in (".zattrs", ".zarray", "zarr.json")) 1548s ] 1548s ) 1548s 1548s # The zarr format is set by the `default_zarr_format` 1548s # pytest fixture that acts on a superclass 1548s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1548s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1548s expected = ["0.1.0"] 1548s else: 1548s expected = [ 1548s "0.0.0", 1548s "0.0.1", 1548s "0.1.0", 1548s "0.1.1", 1548s ] 1548s 1548s if zarr_format_3: 1548s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1548s # transform to the path style of zarr 3 1548s # e.g. 0/0/1 1548s expected = [e.replace(".", "/") for e in expected] 1548s else: 1548s # use nan for default fill_value behaviour 1548s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1548s 1548s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1548s 1548s if has_dask: 1548s ds["test"] = ds["test"].chunk(1) 1548s encoding = None 1548s else: 1548s encoding = {"test": {"chunks": (1, 1, 1)}} 1548s 1548s with self.temp_dir() as (d, store): 1548s ds.to_zarr( 1548s store, 1548s mode="w", 1548s encoding=encoding, 1548s write_empty_chunks=write_empty, 1548s ) 1548s 1548s # check expected files after a write 1548s assert_expected_files(expected, store) 1548s 1548s > with self.roundtrip_dir( 1548s ds, 1548s store, 1548s save_kwargs={ 1548s "mode": "a", 1548s "append_dim": "Z", 1548s "write_empty_chunks": write_empty, 1548s }, 1548s ) as a_ds: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1548s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'test' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s _______________ TestZarrWriteEmpty.test_write_empty[3-True-None] _______________ 1548s 1548s self = 1548s consolidated = None, write_empty = True 1548s 1548s @pytest.mark.parametrize("consolidated", [True, False, None]) 1548s @pytest.mark.parametrize("write_empty", [True, False, None]) 1548s def test_write_empty( 1548s self, 1548s consolidated: bool | None, 1548s write_empty: bool | None, 1548s ) -> None: 1548s def assert_expected_files(expected: list[str], store: str) -> None: 1548s """Convenience for comparing with actual files written""" 1548s ls = [] 1548s test_root = os.path.join(store, "test") 1548s for root, _, files in os.walk(test_root): 1548s ls.extend( 1548s [ 1548s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1548s for f in files 1548s ] 1548s ) 1548s 1548s assert set(expected) == set( 1548s [ 1548s file.lstrip("c/") 1548s for file in ls 1548s if (file not in (".zattrs", ".zarray", "zarr.json")) 1548s ] 1548s ) 1548s 1548s # The zarr format is set by the `default_zarr_format` 1548s # pytest fixture that acts on a superclass 1548s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1548s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1548s expected = ["0.1.0"] 1548s else: 1548s expected = [ 1548s "0.0.0", 1548s "0.0.1", 1548s "0.1.0", 1548s "0.1.1", 1548s ] 1548s 1548s if zarr_format_3: 1548s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1548s # transform to the path style of zarr 3 1548s # e.g. 0/0/1 1548s expected = [e.replace(".", "/") for e in expected] 1548s else: 1548s # use nan for default fill_value behaviour 1548s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1548s 1548s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1548s 1548s if has_dask: 1548s ds["test"] = ds["test"].chunk(1) 1548s encoding = None 1548s else: 1548s encoding = {"test": {"chunks": (1, 1, 1)}} 1548s 1548s with self.temp_dir() as (d, store): 1548s ds.to_zarr( 1548s store, 1548s mode="w", 1548s encoding=encoding, 1548s write_empty_chunks=write_empty, 1548s ) 1548s 1548s # check expected files after a write 1548s assert_expected_files(expected, store) 1548s 1548s > with self.roundtrip_dir( 1548s ds, 1548s store, 1548s save_kwargs={ 1548s "mode": "a", 1548s "append_dim": "Z", 1548s "write_empty_chunks": write_empty, 1548s }, 1548s ) as a_ds: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1548s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'test' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1548s if zarr_array.fill_value is not None: 1548s attributes["_FillValue"] = zarr_array.fill_value 1548s elif "_FillValue" in attributes: 1548s original_zarr_dtype = zarr_array.metadata.data_type 1548s attributes["_FillValue"] = FillValueCoder.decode( 1548s > attributes["_FillValue"], original_zarr_dtype.value 1548s ) 1548s E AttributeError: 'Float64' object has no attribute 'value' 1548s 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1548s ______________ TestZarrWriteEmpty.test_write_empty[3-False-True] _______________ 1548s 1548s self = 1548s consolidated = True, write_empty = False 1548s 1548s @pytest.mark.parametrize("consolidated", [True, False, None]) 1548s @pytest.mark.parametrize("write_empty", [True, False, None]) 1548s def test_write_empty( 1548s self, 1548s consolidated: bool | None, 1548s write_empty: bool | None, 1548s ) -> None: 1548s def assert_expected_files(expected: list[str], store: str) -> None: 1548s """Convenience for comparing with actual files written""" 1548s ls = [] 1548s test_root = os.path.join(store, "test") 1548s for root, _, files in os.walk(test_root): 1548s ls.extend( 1548s [ 1548s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1548s for f in files 1548s ] 1548s ) 1548s 1548s assert set(expected) == set( 1548s [ 1548s file.lstrip("c/") 1548s for file in ls 1548s if (file not in (".zattrs", ".zarray", "zarr.json")) 1548s ] 1548s ) 1548s 1548s # The zarr format is set by the `default_zarr_format` 1548s # pytest fixture that acts on a superclass 1548s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1548s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1548s expected = ["0.1.0"] 1548s else: 1548s expected = [ 1548s "0.0.0", 1548s "0.0.1", 1548s "0.1.0", 1548s "0.1.1", 1548s ] 1548s 1548s if zarr_format_3: 1548s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1548s # transform to the path style of zarr 3 1548s # e.g. 0/0/1 1548s expected = [e.replace(".", "/") for e in expected] 1548s else: 1548s # use nan for default fill_value behaviour 1548s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1548s 1548s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1548s 1548s if has_dask: 1548s ds["test"] = ds["test"].chunk(1) 1548s encoding = None 1548s else: 1548s encoding = {"test": {"chunks": (1, 1, 1)}} 1548s 1548s with self.temp_dir() as (d, store): 1548s ds.to_zarr( 1548s store, 1548s mode="w", 1548s encoding=encoding, 1548s write_empty_chunks=write_empty, 1548s ) 1548s 1548s # check expected files after a write 1548s assert_expected_files(expected, store) 1548s 1548s > with self.roundtrip_dir( 1548s ds, 1548s store, 1548s save_kwargs={ 1548s "mode": "a", 1548s "append_dim": "Z", 1548s "write_empty_chunks": write_empty, 1548s }, 1548s ) as a_ds: 1548s 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1548s return next(self.gen) 1548s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1548s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1548s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1548s return to_zarr( # type: ignore[call-overload,misc] 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1548s dump_to_store(dataset, zstore, writer, encoding=encoding) 1548s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1548s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1548s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1548s k: self.open_store_variable(name=k) for k in existing_variable_names 1548s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1548s 1548s self = , name = 'test' 1548s 1548s def open_store_variable(self, name): 1548s zarr_array = self.members[name] 1548s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1548s try_nczarr = self._mode == "r" 1548s dimensions, attributes = _get_zarr_dims_and_attrs( 1548s zarr_array, DIMENSION_KEY, try_nczarr 1548s ) 1548s attributes = dict(attributes) 1548s 1548s encoding = { 1548s "chunks": zarr_array.chunks, 1548s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1548s } 1548s 1548s if _zarr_v3(): 1548s encoding.update( 1548s { 1548s "compressors": zarr_array.compressors, 1548s "filters": zarr_array.filters, 1548s "shards": zarr_array.shards, 1548s } 1548s ) 1548s if self.zarr_group.metadata.zarr_format == 3: 1548s encoding.update({"serializer": zarr_array.serializer}) 1548s else: 1548s encoding.update( 1548s { 1548s "compressor": zarr_array.compressor, 1548s "filters": zarr_array.filters, 1548s } 1548s ) 1548s 1548s if self._use_zarr_fill_value_as_mask: 1548s # Setting this attribute triggers CF decoding for missing values 1548s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ______________ TestZarrWriteEmpty.test_write_empty[3-False-False] ______________ 1549s 1549s self = 1549s consolidated = False, write_empty = False 1549s 1549s @pytest.mark.parametrize("consolidated", [True, False, None]) 1549s @pytest.mark.parametrize("write_empty", [True, False, None]) 1549s def test_write_empty( 1549s self, 1549s consolidated: bool | None, 1549s write_empty: bool | None, 1549s ) -> None: 1549s def assert_expected_files(expected: list[str], store: str) -> None: 1549s """Convenience for comparing with actual files written""" 1549s ls = [] 1549s test_root = os.path.join(store, "test") 1549s for root, _, files in os.walk(test_root): 1549s ls.extend( 1549s [ 1549s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1549s for f in files 1549s ] 1549s ) 1549s 1549s assert set(expected) == set( 1549s [ 1549s file.lstrip("c/") 1549s for file in ls 1549s if (file not in (".zattrs", ".zarray", "zarr.json")) 1549s ] 1549s ) 1549s 1549s # The zarr format is set by the `default_zarr_format` 1549s # pytest fixture that acts on a superclass 1549s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1549s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1549s expected = ["0.1.0"] 1549s else: 1549s expected = [ 1549s "0.0.0", 1549s "0.0.1", 1549s "0.1.0", 1549s "0.1.1", 1549s ] 1549s 1549s if zarr_format_3: 1549s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1549s # transform to the path style of zarr 3 1549s # e.g. 0/0/1 1549s expected = [e.replace(".", "/") for e in expected] 1549s else: 1549s # use nan for default fill_value behaviour 1549s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1549s 1549s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1549s 1549s if has_dask: 1549s ds["test"] = ds["test"].chunk(1) 1549s encoding = None 1549s else: 1549s encoding = {"test": {"chunks": (1, 1, 1)}} 1549s 1549s with self.temp_dir() as (d, store): 1549s ds.to_zarr( 1549s store, 1549s mode="w", 1549s encoding=encoding, 1549s write_empty_chunks=write_empty, 1549s ) 1549s 1549s # check expected files after a write 1549s assert_expected_files(expected, store) 1549s 1549s > with self.roundtrip_dir( 1549s ds, 1549s store, 1549s save_kwargs={ 1549s "mode": "a", 1549s "append_dim": "Z", 1549s "write_empty_chunks": write_empty, 1549s }, 1549s ) as a_ds: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1549s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ______________ TestZarrWriteEmpty.test_write_empty[3-False-None] _______________ 1549s 1549s self = 1549s consolidated = None, write_empty = False 1549s 1549s @pytest.mark.parametrize("consolidated", [True, False, None]) 1549s @pytest.mark.parametrize("write_empty", [True, False, None]) 1549s def test_write_empty( 1549s self, 1549s consolidated: bool | None, 1549s write_empty: bool | None, 1549s ) -> None: 1549s def assert_expected_files(expected: list[str], store: str) -> None: 1549s """Convenience for comparing with actual files written""" 1549s ls = [] 1549s test_root = os.path.join(store, "test") 1549s for root, _, files in os.walk(test_root): 1549s ls.extend( 1549s [ 1549s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1549s for f in files 1549s ] 1549s ) 1549s 1549s assert set(expected) == set( 1549s [ 1549s file.lstrip("c/") 1549s for file in ls 1549s if (file not in (".zattrs", ".zarray", "zarr.json")) 1549s ] 1549s ) 1549s 1549s # The zarr format is set by the `default_zarr_format` 1549s # pytest fixture that acts on a superclass 1549s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1549s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1549s expected = ["0.1.0"] 1549s else: 1549s expected = [ 1549s "0.0.0", 1549s "0.0.1", 1549s "0.1.0", 1549s "0.1.1", 1549s ] 1549s 1549s if zarr_format_3: 1549s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1549s # transform to the path style of zarr 3 1549s # e.g. 0/0/1 1549s expected = [e.replace(".", "/") for e in expected] 1549s else: 1549s # use nan for default fill_value behaviour 1549s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1549s 1549s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1549s 1549s if has_dask: 1549s ds["test"] = ds["test"].chunk(1) 1549s encoding = None 1549s else: 1549s encoding = {"test": {"chunks": (1, 1, 1)}} 1549s 1549s with self.temp_dir() as (d, store): 1549s ds.to_zarr( 1549s store, 1549s mode="w", 1549s encoding=encoding, 1549s write_empty_chunks=write_empty, 1549s ) 1549s 1549s # check expected files after a write 1549s assert_expected_files(expected, store) 1549s 1549s > with self.roundtrip_dir( 1549s ds, 1549s store, 1549s save_kwargs={ 1549s "mode": "a", 1549s "append_dim": "Z", 1549s "write_empty_chunks": write_empty, 1549s }, 1549s ) as a_ds: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1549s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _______________ TestZarrWriteEmpty.test_write_empty[3-None-True] _______________ 1549s 1549s self = 1549s consolidated = True, write_empty = None 1549s 1549s @pytest.mark.parametrize("consolidated", [True, False, None]) 1549s @pytest.mark.parametrize("write_empty", [True, False, None]) 1549s def test_write_empty( 1549s self, 1549s consolidated: bool | None, 1549s write_empty: bool | None, 1549s ) -> None: 1549s def assert_expected_files(expected: list[str], store: str) -> None: 1549s """Convenience for comparing with actual files written""" 1549s ls = [] 1549s test_root = os.path.join(store, "test") 1549s for root, _, files in os.walk(test_root): 1549s ls.extend( 1549s [ 1549s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1549s for f in files 1549s ] 1549s ) 1549s 1549s assert set(expected) == set( 1549s [ 1549s file.lstrip("c/") 1549s for file in ls 1549s if (file not in (".zattrs", ".zarray", "zarr.json")) 1549s ] 1549s ) 1549s 1549s # The zarr format is set by the `default_zarr_format` 1549s # pytest fixture that acts on a superclass 1549s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1549s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1549s expected = ["0.1.0"] 1549s else: 1549s expected = [ 1549s "0.0.0", 1549s "0.0.1", 1549s "0.1.0", 1549s "0.1.1", 1549s ] 1549s 1549s if zarr_format_3: 1549s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1549s # transform to the path style of zarr 3 1549s # e.g. 0/0/1 1549s expected = [e.replace(".", "/") for e in expected] 1549s else: 1549s # use nan for default fill_value behaviour 1549s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1549s 1549s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1549s 1549s if has_dask: 1549s ds["test"] = ds["test"].chunk(1) 1549s encoding = None 1549s else: 1549s encoding = {"test": {"chunks": (1, 1, 1)}} 1549s 1549s with self.temp_dir() as (d, store): 1549s ds.to_zarr( 1549s store, 1549s mode="w", 1549s encoding=encoding, 1549s write_empty_chunks=write_empty, 1549s ) 1549s 1549s # check expected files after a write 1549s assert_expected_files(expected, store) 1549s 1549s > with self.roundtrip_dir( 1549s ds, 1549s store, 1549s save_kwargs={ 1549s "mode": "a", 1549s "append_dim": "Z", 1549s "write_empty_chunks": write_empty, 1549s }, 1549s ) as a_ds: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1549s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ______________ TestZarrWriteEmpty.test_write_empty[3-None-False] _______________ 1549s 1549s self = 1549s consolidated = False, write_empty = None 1549s 1549s @pytest.mark.parametrize("consolidated", [True, False, None]) 1549s @pytest.mark.parametrize("write_empty", [True, False, None]) 1549s def test_write_empty( 1549s self, 1549s consolidated: bool | None, 1549s write_empty: bool | None, 1549s ) -> None: 1549s def assert_expected_files(expected: list[str], store: str) -> None: 1549s """Convenience for comparing with actual files written""" 1549s ls = [] 1549s test_root = os.path.join(store, "test") 1549s for root, _, files in os.walk(test_root): 1549s ls.extend( 1549s [ 1549s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1549s for f in files 1549s ] 1549s ) 1549s 1549s assert set(expected) == set( 1549s [ 1549s file.lstrip("c/") 1549s for file in ls 1549s if (file not in (".zattrs", ".zarray", "zarr.json")) 1549s ] 1549s ) 1549s 1549s # The zarr format is set by the `default_zarr_format` 1549s # pytest fixture that acts on a superclass 1549s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1549s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1549s expected = ["0.1.0"] 1549s else: 1549s expected = [ 1549s "0.0.0", 1549s "0.0.1", 1549s "0.1.0", 1549s "0.1.1", 1549s ] 1549s 1549s if zarr_format_3: 1549s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1549s # transform to the path style of zarr 3 1549s # e.g. 0/0/1 1549s expected = [e.replace(".", "/") for e in expected] 1549s else: 1549s # use nan for default fill_value behaviour 1549s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1549s 1549s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1549s 1549s if has_dask: 1549s ds["test"] = ds["test"].chunk(1) 1549s encoding = None 1549s else: 1549s encoding = {"test": {"chunks": (1, 1, 1)}} 1549s 1549s with self.temp_dir() as (d, store): 1549s ds.to_zarr( 1549s store, 1549s mode="w", 1549s encoding=encoding, 1549s write_empty_chunks=write_empty, 1549s ) 1549s 1549s # check expected files after a write 1549s assert_expected_files(expected, store) 1549s 1549s > with self.roundtrip_dir( 1549s ds, 1549s store, 1549s save_kwargs={ 1549s "mode": "a", 1549s "append_dim": "Z", 1549s "write_empty_chunks": write_empty, 1549s }, 1549s ) as a_ds: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1549s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _______________ TestZarrWriteEmpty.test_write_empty[3-None-None] _______________ 1549s 1549s self = 1549s consolidated = None, write_empty = None 1549s 1549s @pytest.mark.parametrize("consolidated", [True, False, None]) 1549s @pytest.mark.parametrize("write_empty", [True, False, None]) 1549s def test_write_empty( 1549s self, 1549s consolidated: bool | None, 1549s write_empty: bool | None, 1549s ) -> None: 1549s def assert_expected_files(expected: list[str], store: str) -> None: 1549s """Convenience for comparing with actual files written""" 1549s ls = [] 1549s test_root = os.path.join(store, "test") 1549s for root, _, files in os.walk(test_root): 1549s ls.extend( 1549s [ 1549s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1549s for f in files 1549s ] 1549s ) 1549s 1549s assert set(expected) == set( 1549s [ 1549s file.lstrip("c/") 1549s for file in ls 1549s if (file not in (".zattrs", ".zarray", "zarr.json")) 1549s ] 1549s ) 1549s 1549s # The zarr format is set by the `default_zarr_format` 1549s # pytest fixture that acts on a superclass 1549s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1549s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1549s expected = ["0.1.0"] 1549s else: 1549s expected = [ 1549s "0.0.0", 1549s "0.0.1", 1549s "0.1.0", 1549s "0.1.1", 1549s ] 1549s 1549s if zarr_format_3: 1549s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1549s # transform to the path style of zarr 3 1549s # e.g. 0/0/1 1549s expected = [e.replace(".", "/") for e in expected] 1549s else: 1549s # use nan for default fill_value behaviour 1549s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1549s 1549s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1549s 1549s if has_dask: 1549s ds["test"] = ds["test"].chunk(1) 1549s encoding = None 1549s else: 1549s encoding = {"test": {"chunks": (1, 1, 1)}} 1549s 1549s with self.temp_dir() as (d, store): 1549s ds.to_zarr( 1549s store, 1549s mode="w", 1549s encoding=encoding, 1549s write_empty_chunks=write_empty, 1549s ) 1549s 1549s # check expected files after a write 1549s assert_expected_files(expected, store) 1549s 1549s > with self.roundtrip_dir( 1549s ds, 1549s store, 1549s save_kwargs={ 1549s "mode": "a", 1549s "append_dim": "Z", 1549s "write_empty_chunks": write_empty, 1549s }, 1549s ) as a_ds: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1549s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-full-auto] _____________ 1549s 1549s self = 1549s region = 'auto' 1549s 1549s @pytest.mark.parametrize( 1549s "region", 1549s [ 1549s pytest.param("auto", id="full-auto"), 1549s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1549s ], 1549s ) 1549s def test_zarr_region_auto(self, region): 1549s with self.create() as (target, ds): 1549s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1549s > self.save(target, ds_region, region=region) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-mixed-auto] ____________ 1549s 1549s self = 1549s region = {'x': slice(np.int32(2), np.int32(4), None), 'y': slice(6, 8, None)} 1549s 1549s @pytest.mark.parametrize( 1549s "region", 1549s [ 1549s pytest.param("auto", id="full-auto"), 1549s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1549s ], 1549s ) 1549s def test_zarr_region_auto(self, region): 1549s with self.create() as (target, ds): 1549s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1549s > self.save(target, ds_region, region=region) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ______________ TestZarrRegionAuto.test_zarr_region_index_write[3] ______________ 1549s 1549s self = 1549s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_zarr_region_index_write_30') 1549s 1549s def test_zarr_region_index_write(self, tmp_path): 1549s region: Mapping[str, slice] | Literal["auto"] 1549s region_slice = dict(x=slice(2, 4), y=slice(6, 8)) 1549s 1549s with self.create() as (target, ds): 1549s ds_region = 1 + ds.isel(region_slice) 1549s for region in [region_slice, "auto"]: # type: ignore[assignment] 1549s with patch.object( 1549s ZarrStore, 1549s "set_variables", 1549s side_effect=ZarrStore.set_variables, 1549s autospec=True, 1549s ) as mock: 1549s > self.save(target, ds_region, region=region, mode="r+") 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6336: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ____________________ TestZarrRegionAuto.test_zarr_region[3] ____________________ 1549s 1549s self = 1549s 1549s def test_zarr_region(self): 1549s with self.create() as (target, ds): 1549s ds_transposed = ds.transpose("y", "x") 1549s ds_region = 1 + ds_transposed.isel(x=[0], y=[0]) 1549s > self.save(target, ds_region, region={"x": slice(0, 1), "y": slice(0, 1)}) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6369: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'test' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _____________ TestZarrRegionAuto.test_zarr_append_chunk_partial[3] _____________ 1549s 1549s self = 1549s 1549s @requires_dask 1549s def test_zarr_append_chunk_partial(self): 1549s t_coords = np.array([np.datetime64("2020-01-01").astype("datetime64[ns]")]) 1549s data = np.ones((10, 10)) 1549s 1549s da = xr.DataArray( 1549s data.reshape((-1, 10, 10)), 1549s dims=["time", "x", "y"], 1549s coords={"time": t_coords}, 1549s name="foo", 1549s ) 1549s new_time = np.array([np.datetime64("2021-01-01").astype("datetime64[ns]")]) 1549s da2 = xr.DataArray( 1549s data.reshape((-1, 10, 10)), 1549s dims=["time", "x", "y"], 1549s coords={"time": new_time}, 1549s name="foo", 1549s ) 1549s 1549s with self.create_zarr_target() as target: 1549s self.save(target, da, mode="w", encoding={"foo": {"chunks": (5, 5, 1)}}) 1549s 1549s with pytest.raises(ValueError, match="encoding was provided"): 1549s self.save( 1549s target, 1549s da2, 1549s append_dim="time", 1549s mode="a", 1549s encoding={"foo": {"chunks": (1, 1, 1)}}, 1549s ) 1549s 1549s # chunking with dask sidesteps the encoding check, so we need a different check 1549s with pytest.raises(ValueError, match="Specified zarr chunks"): 1549s > self.save( 1549s target, 1549s da2.chunk({"x": 1, "y": 1, "time": 1}), 1549s append_dim="time", 1549s mode="a", 1549s ) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6426: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'foo' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _________ TestZarrRegionAuto.test_zarr_region_chunk_partial_offset[3] __________ 1549s 1549s self = 1549s 1549s @requires_dask 1549s def test_zarr_region_chunk_partial_offset(self): 1549s # https://github.com/pydata/xarray/pull/8459#issuecomment-1819417545 1549s with self.create_zarr_target() as store: 1549s data = np.ones((30,)) 1549s da = xr.DataArray( 1549s data, dims=["x"], coords={"x": range(30)}, name="foo" 1549s ).chunk(x=10) 1549s self.save(store, da, compute=False) 1549s 1549s > self.save(store, da.isel(x=slice(10)).chunk(x=(10,)), region="auto") 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6443: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'foo' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s ____________ TestZarrRegionAuto.test_zarr_safe_chunk_append_dim[3] _____________ 1549s 1549s self = 1549s 1549s @requires_dask 1549s def test_zarr_safe_chunk_append_dim(self): 1549s with self.create_zarr_target() as store: 1549s data = np.ones((20,)) 1549s da = xr.DataArray( 1549s data, dims=["x"], coords={"x": range(20)}, name="foo" 1549s ).chunk(x=5) 1549s 1549s self.save(store, da.isel(x=slice(0, 7)), safe_chunks=True, mode="w") 1549s with pytest.raises(ValueError): 1549s # If the first chunk is smaller than the border size then raise an error 1549s > self.save( 1549s store, 1549s da.isel(x=slice(7, 11)).chunk(x=(2, 2)), 1549s append_dim="x", 1549s safe_chunks=True, 1549s ) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6468: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = , name = 'foo' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-r+] _____________ 1549s 1549s self = 1549s mode = 'r+' 1549s 1549s @requires_dask 1549s @pytest.mark.parametrize("mode", ["r+", "a"]) 1549s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1549s with self.create_zarr_target() as store: 1549s arr = xr.DataArray( 1549s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1549s ).chunk(a=3) 1549s self.save(store, arr, mode="w") 1549s 1549s with pytest.raises(ValueError): 1549s # There are two Dask chunks on the same Zarr chunk, 1549s # which means that it is unsafe in any mode 1549s self.save( 1549s store, 1549s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1549s region="auto", 1549s mode=mode, 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # the first chunk is covering the border size, but it is not 1549s # completely covering the second chunk, which means that it is 1549s # unsafe in any mode 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1549s region="auto", 1549s mode=mode, 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # The first chunk is safe but the other two chunks are overlapping with 1549s # the same Zarr chunk 1549s self.save( 1549s store, 1549s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1549s region="auto", 1549s mode=mode, 1549s ) 1549s 1549s # Fully update two contiguous chunks is safe in any mode 1549s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1549s 1549s # The last chunk is considered full based on their current size (2) 1549s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1549s self.save( 1549s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1549s ) 1549s 1549s # Write the last chunk of a region partially is safe in "a" mode 1549s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1549s with pytest.raises(ValueError): 1549s # with "r+" mode it is invalid to write partial chunk 1549s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1549s 1549s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1549s self.save( 1549s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1549s ) 1549s with pytest.raises(ValueError): 1549s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s # This is safe on mode "a" because there is a single dask chunk 1549s self.save( 1549s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1549s ) 1549s with pytest.raises(ValueError): 1549s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1549s # in the first chunk of Zarr 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s # The first chunk is completely covering the first Zarr chunk 1549s # and the last chunk is a partial one 1549s self.save( 1549s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # The last chunk is partial, so it is considered unsafe on mode "r+" 1549s self.save( 1549s store, 1549s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s # The first chunk is covering the border size (2 elements) 1549s # and also the second chunk (3 elements), so it is valid 1549s self.save( 1549s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # The first chunk is not fully covering the first zarr chunk 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # Validate that the border condition is not affecting the "r+" mode 1549s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1549s 1549s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1549s with pytest.raises(ValueError): 1549s # Validate that even if we write with a single Dask chunk on the last Zarr 1549s # chunk it is still unsafe if it is not fully covering it 1549s # (the last Zarr chunk has size 2) 1549s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1549s 1549s # Validate the same as the above test but in the beginning of the last chunk 1549s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1549s with pytest.raises(ValueError): 1549s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1549s 1549s self.save( 1549s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1549s ) 1549s with pytest.raises(ValueError): 1549s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1549s # if it is partial covering other Zarr chunks 1549s self.save( 1549s store, 1549s arr.isel(a=slice(7, None)).chunk(a=-1), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # If the chunk is of size equal to the one in the Zarr encoding, but 1549s # it is partially writing in the first chunk then raise an error 1549s self.save( 1549s store, 1549s arr.isel(a=slice(8, None)).chunk(a=3), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s self.save( 1549s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1549s ) 1549s 1549s # Test if the code is detecting the last chunk correctly 1549s data = np.random.default_rng(0).random((2920, 25, 53)) 1549s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1549s chunks = {"time": 1000, "lat": 25, "lon": 53} 1549s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1549s region = {"time": slice(1000, 2000, 1)} 1549s chunk = ds.isel(region) 1549s chunk = chunk.chunk() 1549s > self.save(store, chunk.chunk(), region=region) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = 1549s name = 'temperature' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-a] ______________ 1549s 1549s self = 1549s mode = 'a' 1549s 1549s @requires_dask 1549s @pytest.mark.parametrize("mode", ["r+", "a"]) 1549s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1549s with self.create_zarr_target() as store: 1549s arr = xr.DataArray( 1549s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1549s ).chunk(a=3) 1549s self.save(store, arr, mode="w") 1549s 1549s with pytest.raises(ValueError): 1549s # There are two Dask chunks on the same Zarr chunk, 1549s # which means that it is unsafe in any mode 1549s self.save( 1549s store, 1549s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1549s region="auto", 1549s mode=mode, 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # the first chunk is covering the border size, but it is not 1549s # completely covering the second chunk, which means that it is 1549s # unsafe in any mode 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1549s region="auto", 1549s mode=mode, 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # The first chunk is safe but the other two chunks are overlapping with 1549s # the same Zarr chunk 1549s self.save( 1549s store, 1549s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1549s region="auto", 1549s mode=mode, 1549s ) 1549s 1549s # Fully update two contiguous chunks is safe in any mode 1549s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1549s 1549s # The last chunk is considered full based on their current size (2) 1549s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1549s self.save( 1549s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1549s ) 1549s 1549s # Write the last chunk of a region partially is safe in "a" mode 1549s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1549s with pytest.raises(ValueError): 1549s # with "r+" mode it is invalid to write partial chunk 1549s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1549s 1549s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1549s self.save( 1549s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1549s ) 1549s with pytest.raises(ValueError): 1549s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s # This is safe on mode "a" because there is a single dask chunk 1549s self.save( 1549s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1549s ) 1549s with pytest.raises(ValueError): 1549s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1549s # in the first chunk of Zarr 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s # The first chunk is completely covering the first Zarr chunk 1549s # and the last chunk is a partial one 1549s self.save( 1549s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # The last chunk is partial, so it is considered unsafe on mode "r+" 1549s self.save( 1549s store, 1549s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s # The first chunk is covering the border size (2 elements) 1549s # and also the second chunk (3 elements), so it is valid 1549s self.save( 1549s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # The first chunk is not fully covering the first zarr chunk 1549s self.save( 1549s store, 1549s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # Validate that the border condition is not affecting the "r+" mode 1549s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1549s 1549s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1549s with pytest.raises(ValueError): 1549s # Validate that even if we write with a single Dask chunk on the last Zarr 1549s # chunk it is still unsafe if it is not fully covering it 1549s # (the last Zarr chunk has size 2) 1549s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1549s 1549s # Validate the same as the above test but in the beginning of the last chunk 1549s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1549s with pytest.raises(ValueError): 1549s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1549s 1549s self.save( 1549s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1549s ) 1549s with pytest.raises(ValueError): 1549s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1549s # if it is partial covering other Zarr chunks 1549s self.save( 1549s store, 1549s arr.isel(a=slice(7, None)).chunk(a=-1), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s # If the chunk is of size equal to the one in the Zarr encoding, but 1549s # it is partially writing in the first chunk then raise an error 1549s self.save( 1549s store, 1549s arr.isel(a=slice(8, None)).chunk(a=3), 1549s region="auto", 1549s mode="r+", 1549s ) 1549s 1549s with pytest.raises(ValueError): 1549s self.save( 1549s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1549s ) 1549s 1549s # Test if the code is detecting the last chunk correctly 1549s data = np.random.default_rng(0).random((2920, 25, 53)) 1549s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1549s chunks = {"time": 1000, "lat": 25, "lon": 53} 1549s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1549s region = {"time": slice(1000, 2000, 1)} 1549s chunk = ds.isel(region) 1549s chunk = chunk.chunk() 1549s > self.save(store, chunk.chunk(), region=region) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1549s ds.to_zarr(target, **kwargs) 1549s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1549s return to_zarr( # type: ignore[call-overload,misc] 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1549s dump_to_store(dataset, zstore, writer, encoding=encoding) 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1549s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1549s k: self.open_store_variable(name=k) for k in existing_variable_names 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s self = 1549s name = 'temperature' 1549s 1549s def open_store_variable(self, name): 1549s zarr_array = self.members[name] 1549s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1549s try_nczarr = self._mode == "r" 1549s dimensions, attributes = _get_zarr_dims_and_attrs( 1549s zarr_array, DIMENSION_KEY, try_nczarr 1549s ) 1549s attributes = dict(attributes) 1549s 1549s encoding = { 1549s "chunks": zarr_array.chunks, 1549s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1549s } 1549s 1549s if _zarr_v3(): 1549s encoding.update( 1549s { 1549s "compressors": zarr_array.compressors, 1549s "filters": zarr_array.filters, 1549s "shards": zarr_array.shards, 1549s } 1549s ) 1549s if self.zarr_group.metadata.zarr_format == 3: 1549s encoding.update({"serializer": zarr_array.serializer}) 1549s else: 1549s encoding.update( 1549s { 1549s "compressor": zarr_array.compressor, 1549s "filters": zarr_array.filters, 1549s } 1549s ) 1549s 1549s if self._use_zarr_fill_value_as_mask: 1549s # Setting this attribute triggers CF decoding for missing values 1549s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1549s if zarr_array.fill_value is not None: 1549s attributes["_FillValue"] = zarr_array.fill_value 1549s elif "_FillValue" in attributes: 1549s original_zarr_dtype = zarr_array.metadata.data_type 1549s attributes["_FillValue"] = FillValueCoder.decode( 1549s > attributes["_FillValue"], original_zarr_dtype.value 1549s ) 1549s E AttributeError: 'Float64' object has no attribute 'value' 1549s 1549s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1549s _____________ TestScipyFilePath.test_roundtrip_example_1_netcdf_gz _____________ 1549s 1549s self = 1549s 1549s def test_roundtrip_example_1_netcdf_gz(self) -> None: 1549s with open_example_dataset("example_1.nc.gz") as expected: 1549s > with open_example_dataset("example_1.nc") as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3940: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:164: in open_example_dataset 1549s return open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _____________ TestGenericNetCDFData.test_zero_dimensional_variable _____________ 1549s 1549s self = 1549s 1549s def test_zero_dimensional_variable(self) -> None: 1549s expected = create_test_data() 1549s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1549s expected["bytes_var"] = ([], b"foobar") 1549s expected["string_var"] = ([], "foobar") 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ________________ TestGenericNetCDFData.test_roundtrip_test_data ________________ 1549s 1549s self = 1549s 1549s def test_roundtrip_test_data(self) -> None: 1549s expected = create_test_data() 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _______________________ TestGenericNetCDFData.test_load ________________________ 1549s 1549s self = 1549s 1549s def test_load(self) -> None: 1549s expected = create_test_data() 1549s 1549s @contextlib.contextmanager 1549s def assert_loads(vars=None): 1549s if vars is None: 1549s vars = expected 1549s with self.roundtrip(expected) as actual: 1549s for k, v in actual.variables.items(): 1549s # IndexVariables are eagerly loaded into memory 1549s assert v._in_memory == (k in actual.dims) 1549s yield actual 1549s for k, v in actual.variables.items(): 1549s if k in vars: 1549s assert v._in_memory 1549s assert_identical(expected, actual) 1549s 1549s with pytest.raises(AssertionError): 1549s # make sure the contextmanager works! 1549s > with assert_loads() as ds: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1549s with self.roundtrip(expected) as actual: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s __________________ TestGenericNetCDFData.test_dataset_compute __________________ 1549s 1549s self = 1549s 1549s def test_dataset_compute(self) -> None: 1549s expected = create_test_data() 1549s 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________________ TestGenericNetCDFData.test_pickle _______________________ 1549s 1549s self = 1549s 1549s def test_pickle(self) -> None: 1549s expected = Dataset({"foo": ("x", [42])}) 1549s > with self.roundtrip(expected, allow_cleanup_failure=ON_WINDOWS) as roundtripped: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:499: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _________________ TestGenericNetCDFData.test_pickle_dataarray __________________ 1549s 1549s self = 1549s 1549s @pytest.mark.filterwarnings("ignore:deallocating CachingFileManager") 1549s def test_pickle_dataarray(self) -> None: 1549s expected = Dataset({"foo": ("x", [42])}) 1549s > with self.roundtrip(expected, allow_cleanup_failure=ON_WINDOWS) as roundtripped: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:509: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s __________________ TestGenericNetCDFData.test_dataset_caching __________________ 1549s 1549s self = 1549s 1549s def test_dataset_caching(self) -> None: 1549s expected = Dataset({"foo": ("x", [5, 6, 7])}) 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:519: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________ TestGenericNetCDFData.test_roundtrip_None_variable ______________ 1549s 1549s self = 1549s 1549s @pytest.mark.filterwarnings("ignore:deallocating CachingFileManager") 1549s def test_roundtrip_None_variable(self) -> None: 1549s expected = Dataset({None: (("x", "y"), [[0, 1], [2, 3]])}) 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:534: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________ TestGenericNetCDFData.test_roundtrip_object_dtype _______________ 1549s 1549s self = 1549s 1549s def test_roundtrip_object_dtype(self) -> None: 1549s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1549s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1549s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1549s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1549s strings = np.array(["ab", "cdef", "g"], dtype=object) 1549s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1549s all_nans = np.array([np.nan, np.nan], dtype=object) 1549s original = Dataset( 1549s { 1549s "floats": ("a", floats), 1549s "floats_nans": ("a", floats_nans), 1549s "bytes": ("b", bytes_), 1549s "bytes_nans": ("b", bytes_nans), 1549s "strings": ("b", strings), 1549s "strings_nans": ("b", strings_nans), 1549s "all_nans": ("c", all_nans), 1549s "nan": ([], np.nan), 1549s } 1549s ) 1549s expected = original.copy(deep=True) 1549s > with self.roundtrip(original) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _______________ TestGenericNetCDFData.test_roundtrip_string_data _______________ 1549s 1549s self = 1549s 1549s def test_roundtrip_string_data(self) -> None: 1549s expected = Dataset({"x": ("t", ["ab", "cdef"])}) 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:575: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ________ TestGenericNetCDFData.test_roundtrip_string_encoded_characters ________ 1549s 1549s self = 1549s 1549s def test_roundtrip_string_encoded_characters(self) -> None: 1549s expected = Dataset({"x": ("t", ["ab", "cdef"])}) 1549s expected["x"].encoding["dtype"] = "S1" 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:581: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ___________ TestGenericNetCDFData.test_roundtrip_numpy_datetime_data ___________ 1549s 1549s self = 1549s 1549s def test_roundtrip_numpy_datetime_data(self) -> None: 1549s times = pd.to_datetime(["2000-01-01", "2000-01-02", "NaT"], unit="ns") 1549s expected = Dataset({"t": ("t", times), "t0": times[0]}) 1549s kwargs = {"encoding": {"t0": {"units": "days since 1950-01-01"}}} 1549s > with self.roundtrip(expected, save_kwargs=kwargs) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:594: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s __________ TestGenericNetCDFData.test_roundtrip_cftime_datetime_data ___________ 1549s 1549s self = 1549s 1549s @requires_cftime 1549s def test_roundtrip_cftime_datetime_data(self) -> None: 1549s from xarray.tests.test_coding_times import _all_cftime_date_types 1549s 1549s date_types = _all_cftime_date_types() 1549s for date_type in date_types.values(): 1549s times = [date_type(1, 1, 1), date_type(1, 1, 2)] 1549s expected = Dataset({"t": ("t", times), "t0": times[0]}) 1549s kwargs = {"encoding": {"t0": {"units": "days since 0001-01-01"}}} 1549s expected_decoded_t = np.array(times) 1549s expected_decoded_t0 = np.array([date_type(1, 1, 1)]) 1549s expected_calendar = times[0].calendar 1549s 1549s with warnings.catch_warnings(): 1549s if expected_calendar in {"proleptic_gregorian", "standard"}: 1549s warnings.filterwarnings("ignore", "Unable to decode time axis") 1549s 1549s > with self.roundtrip(expected, save_kwargs=kwargs) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:615: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _____________ TestGenericNetCDFData.test_roundtrip_timedelta_data ______________ 1549s 1549s self = 1549s 1549s def test_roundtrip_timedelta_data(self) -> None: 1549s # todo: suggestion from review: 1549s # roundtrip large microsecond or coarser resolution timedeltas, 1549s # though we cannot test that until we fix the timedelta decoding 1549s # to support large ranges 1549s time_deltas = pd.to_timedelta(["1h", "2h", "NaT"]).as_unit("s") # type: ignore[arg-type, unused-ignore] 1549s expected = Dataset({"td": ("td", time_deltas), "td0": time_deltas[0]}) 1549s > with self.roundtrip( 1549s expected, open_kwargs={"decode_timedelta": CFTimedeltaCoder(time_unit="ns")} 1549s ) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:639: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________ TestGenericNetCDFData.test_roundtrip_float64_data _______________ 1549s 1549s self = 1549s 1549s def test_roundtrip_float64_data(self) -> None: 1549s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1549s > with self.roundtrip(expected) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _______________ TestGenericNetCDFData.test_roundtrip_coordinates _______________ 1549s 1549s self = 1549s 1549s def test_roundtrip_coordinates(self) -> None: 1549s original = Dataset( 1549s {"foo": ("x", [0, 1])}, {"x": [2, 3], "y": ("a", [42]), "z": ("x", [4, 5])} 1549s ) 1549s 1549s > with self.roundtrip(original) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:664: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ___________ TestGenericNetCDFData.test_roundtrip_global_coordinates ____________ 1549s 1549s self = 1549s 1549s def test_roundtrip_global_coordinates(self) -> None: 1549s original = Dataset( 1549s {"foo": ("x", [0, 1])}, {"x": [2, 3], "y": ("a", [42]), "z": ("x", [4, 5])} 1549s ) 1549s > with self.roundtrip(original) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:679: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _________ TestGenericNetCDFData.test_roundtrip_coordinates_with_space __________ 1549s 1549s self = 1549s 1549s def test_roundtrip_coordinates_with_space(self) -> None: 1549s original = Dataset(coords={"x": 0, "y z": 1}) 1549s expected = Dataset({"y z": 1}, {"x": 0}) 1549s with pytest.warns(SerializationWarning): 1549s > with self.roundtrip(original) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:696: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________ TestGenericNetCDFData.test_roundtrip_boolean_dtype ______________ 1549s 1549s self = 1549s 1549s def test_roundtrip_boolean_dtype(self) -> None: 1549s original = create_boolean_data() 1549s assert original["x"].dtype == "bool" 1549s > with self.roundtrip(original) as actual: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:702: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ________________ TestGenericNetCDFData.test_orthogonal_indexing ________________ 1549s 1549s self = 1549s 1549s def test_orthogonal_indexing(self) -> None: 1549s in_memory = create_test_data() 1549s > with self.roundtrip(in_memory) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ________________ TestGenericNetCDFData.test_vectorized_indexing ________________ 1549s 1549s self = 1549s 1549s def test_vectorized_indexing(self) -> None: 1549s in_memory = create_test_data() 1549s > with self.roundtrip(in_memory) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _________ TestGenericNetCDFData.test_vectorized_indexing_negative_step _________ 1549s 1549s self = 1549s 1549s def test_vectorized_indexing_negative_step(self) -> None: 1549s # use dask explicitly when present 1549s open_kwargs: dict[str, Any] | None 1549s if has_dask: 1549s open_kwargs = {"chunks": {}} 1549s else: 1549s open_kwargs = None 1549s in_memory = create_test_data() 1549s 1549s def multiple_indexing(indexers): 1549s # make sure a sequence of lazy indexings certainly works. 1549s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1549s actual = on_disk["var3"] 1549s expected = in_memory["var3"] 1549s for ind in indexers: 1549s actual = actual.isel(ind) 1549s expected = expected.isel(ind) 1549s # make sure the array is not yet loaded into memory 1549s assert not actual.variable._in_memory 1549s assert_identical(expected, actual.load()) 1549s 1549s # with negative step slice. 1549s indexers = [ 1549s { 1549s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1549s "dim3": slice(-1, 1, -1), 1549s } 1549s ] 1549s > multiple_indexing(indexers) 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1549s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________ TestGenericNetCDFData.test_outer_indexing_reversed ______________ 1549s 1549s self = 1549s 1549s def test_outer_indexing_reversed(self) -> None: 1549s # regression test for GH6560 1549s ds = xr.Dataset( 1549s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1549s ) 1549s 1549s > with self.roundtrip(ds) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s __________________ TestGenericNetCDFData.test_isel_dataarray ___________________ 1549s 1549s self = 1549s 1549s def test_isel_dataarray(self) -> None: 1549s # Make sure isel works lazily. GH:issue:1688 1549s in_memory = create_test_data() 1549s > with self.roundtrip(in_memory) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s _____________ TestGenericNetCDFData.test_array_type_after_indexing _____________ 1549s 1549s self = 1549s 1549s def test_array_type_after_indexing(self) -> None: 1549s in_memory = create_test_data() 1549s > with self.roundtrip(in_memory) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ______________________ TestGenericNetCDFData.test_dropna _______________________ 1549s 1549s self = 1549s 1549s def test_dropna(self) -> None: 1549s # regression test for GH:issue:1694 1549s a = np.random.randn(4, 3) 1549s a[1, 1] = np.nan 1549s in_memory = xr.Dataset( 1549s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1549s ) 1549s 1549s assert_identical( 1549s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1549s ) 1549s 1549s > with self.roundtrip(in_memory) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1549s store = NetCDF4DataStore.open( 1549s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1549s import netCDF4 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s 1549s # init for netCDF4. package 1549s # Docstring comes from extension module _netCDF4. 1549s > from ._netCDF4 import * 1549s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1549s 1549s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1549s ________________ TestGenericNetCDFData.test_ondisk_after_print _________________ 1549s 1549s self = 1549s 1549s def test_ondisk_after_print(self) -> None: 1549s """Make sure print does not load file into memory""" 1549s in_memory = create_test_data() 1549s > with self.roundtrip(in_memory) as on_disk: 1549s 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1549s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1549s with self.open(path, **open_kwargs) as ds: 1549s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1549s return next(self.gen) 1549s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1549s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1549s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1549s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s __________ TestGenericNetCDFData.test_roundtrip_bytes_with_fill_value __________ 1550s 1550s self = 1550s 1550s def test_roundtrip_bytes_with_fill_value(self) -> None: 1550s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1550s encoding = {"_FillValue": b"X", "dtype": "S1"} 1550s original = Dataset({"x": ("t", values, {}, encoding)}) 1550s expected = original.copy(deep=True) 1550s > with self.roundtrip(original) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _________ TestGenericNetCDFData.test_roundtrip_empty_vlen_string_array _________ 1550s 1550s self = 1550s 1550s def test_roundtrip_empty_vlen_string_array(self) -> None: 1550s # checks preserving vlen dtype for empty arrays GH7862 1550s dtype = create_vlen_dtype(str) 1550s original = Dataset({"a": np.array([], dtype=dtype)}) 1550s assert check_vlen_dtype(original["a"].dtype) is str 1550s > with self.roundtrip(original) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:936: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _______ TestGenericNetCDFData.test_roundtrip_unsigned[fill_value0-False] _______ 1550s 1550s self = 1550s fill_value = np.int8(-1), exp_fill_warning = False 1550s 1550s @pytest.mark.parametrize( 1550s ("fill_value", "exp_fill_warning"), 1550s [ 1550s (np.int8(-1), False), 1550s (np.uint8(255), True), 1550s (-1, False), 1550s (255, True), 1550s ], 1550s ) 1550s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1550s @contextlib.contextmanager 1550s def _roundtrip_with_warnings(*args, **kwargs): 1550s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1550s if exp_fill_warning and is_np2: 1550s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1550s SerializationWarning, 1550s match="_FillValue attribute can't be represented", 1550s ) 1550s else: 1550s warn_checker = contextlib.nullcontext() 1550s with warn_checker: 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s yield actual 1550s 1550s # regression/numpy2 test for 1550s encoding = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s "dtype": "i1", 1550s } 1550s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1550s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1550s 1550s attributes = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s } 1550s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1550s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1550s encoded = Dataset({"x": ("t", sb, attributes)}) 1550s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1550s 1550s > with _roundtrip_with_warnings(decoded) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _______ TestGenericNetCDFData.test_roundtrip_unsigned[fill_value1-True] ________ 1550s 1550s self = 1550s fill_value = np.uint8(255), exp_fill_warning = True 1550s 1550s @pytest.mark.parametrize( 1550s ("fill_value", "exp_fill_warning"), 1550s [ 1550s (np.int8(-1), False), 1550s (np.uint8(255), True), 1550s (-1, False), 1550s (255, True), 1550s ], 1550s ) 1550s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1550s @contextlib.contextmanager 1550s def _roundtrip_with_warnings(*args, **kwargs): 1550s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1550s if exp_fill_warning and is_np2: 1550s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1550s SerializationWarning, 1550s match="_FillValue attribute can't be represented", 1550s ) 1550s else: 1550s warn_checker = contextlib.nullcontext() 1550s with warn_checker: 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s yield actual 1550s 1550s # regression/numpy2 test for 1550s encoding = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s "dtype": "i1", 1550s } 1550s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1550s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1550s 1550s attributes = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s } 1550s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1550s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1550s encoded = Dataset({"x": ("t", sb, attributes)}) 1550s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1550s 1550s > with _roundtrip_with_warnings(decoded) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ___________ TestGenericNetCDFData.test_roundtrip_unsigned[-1-False] ____________ 1550s 1550s self = 1550s fill_value = -1, exp_fill_warning = False 1550s 1550s @pytest.mark.parametrize( 1550s ("fill_value", "exp_fill_warning"), 1550s [ 1550s (np.int8(-1), False), 1550s (np.uint8(255), True), 1550s (-1, False), 1550s (255, True), 1550s ], 1550s ) 1550s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1550s @contextlib.contextmanager 1550s def _roundtrip_with_warnings(*args, **kwargs): 1550s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1550s if exp_fill_warning and is_np2: 1550s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1550s SerializationWarning, 1550s match="_FillValue attribute can't be represented", 1550s ) 1550s else: 1550s warn_checker = contextlib.nullcontext() 1550s with warn_checker: 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s yield actual 1550s 1550s # regression/numpy2 test for 1550s encoding = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s "dtype": "i1", 1550s } 1550s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1550s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1550s 1550s attributes = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s } 1550s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1550s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1550s encoded = Dataset({"x": ("t", sb, attributes)}) 1550s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1550s 1550s > with _roundtrip_with_warnings(decoded) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ___________ TestGenericNetCDFData.test_roundtrip_unsigned[255-True] ____________ 1550s 1550s self = 1550s fill_value = 255, exp_fill_warning = True 1550s 1550s @pytest.mark.parametrize( 1550s ("fill_value", "exp_fill_warning"), 1550s [ 1550s (np.int8(-1), False), 1550s (np.uint8(255), True), 1550s (-1, False), 1550s (255, True), 1550s ], 1550s ) 1550s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1550s @contextlib.contextmanager 1550s def _roundtrip_with_warnings(*args, **kwargs): 1550s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1550s if exp_fill_warning and is_np2: 1550s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1550s SerializationWarning, 1550s match="_FillValue attribute can't be represented", 1550s ) 1550s else: 1550s warn_checker = contextlib.nullcontext() 1550s with warn_checker: 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s yield actual 1550s 1550s # regression/numpy2 test for 1550s encoding = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s "dtype": "i1", 1550s } 1550s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1550s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1550s 1550s attributes = { 1550s "_FillValue": fill_value, 1550s "_Unsigned": "true", 1550s } 1550s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1550s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1550s encoded = Dataset({"x": ("t", sb, attributes)}) 1550s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1550s 1550s > with _roundtrip_with_warnings(decoded) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1550s with self.roundtrip(*args, **kwargs) as actual: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestGenericNetCDFData.test_grid_mapping_and_bounds_are_not_coordinates_in_file _ 1550s 1550s self = 1550s 1550s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1550s original = self._create_cf_dataset() 1550s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ___ TestGenericNetCDFData.test_coordinate_variables_after_dataset_roundtrip ____ 1550s 1550s self = 1550s 1550s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1550s original = self._create_cf_dataset() 1550s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestGenericNetCDFData.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip _ 1550s 1550s self = 1550s 1550s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1550s self, 1550s ) -> None: 1550s original = self._create_cf_dataset() 1550s # The DataArray roundtrip should have the same warnings as the 1550s # Dataset, but we already tested for those, so just go for the 1550s # new warnings. It would appear that there is no way to tell 1550s # pytest "This warning and also this warning should both be 1550s # present". 1550s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1550s # needs the to_dataset. The other backends should be fine 1550s # without it. 1550s with pytest.warns( 1550s UserWarning, 1550s match=( 1550s r"Variable\(s\) referenced in bounds not in variables: " 1550s r"\['l(at|ong)itude_bnds'\]" 1550s ), 1550s ): 1550s > with self.roundtrip( 1550s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1550s ) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s 1550s During handling of the above exception, another exception occurred: 1550s 1550s self = 1550s 1550s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1550s self, 1550s ) -> None: 1550s original = self._create_cf_dataset() 1550s # The DataArray roundtrip should have the same warnings as the 1550s # Dataset, but we already tested for those, so just go for the 1550s # new warnings. It would appear that there is no way to tell 1550s # pytest "This warning and also this warning should both be 1550s # present". 1550s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1550s # needs the to_dataset. The other backends should be fine 1550s # without it. 1550s > with pytest.warns( 1550s UserWarning, 1550s match=( 1550s r"Variable\(s\) referenced in bounds not in variables: " 1550s r"\['l(at|ong)itude_bnds'\]" 1550s ), 1550s ): 1550s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 1550s E Emitted warnings: []. 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1550s _______________ TestGenericNetCDFData.test_coordinates_encoding ________________ 1550s 1550s self = 1550s 1550s def test_coordinates_encoding(self) -> None: 1550s def equals_latlon(obj): 1550s return obj == "lat lon" or obj == "lon lat" 1550s 1550s original = Dataset( 1550s {"temp": ("x", [0, 1]), "precip": ("x", [0, -1])}, 1550s {"lat": ("x", [2, 3]), "lon": ("x", [4, 5])}, 1550s ) 1550s > with self.roundtrip(original) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1207: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s __________________ TestGenericNetCDFData.test_encoding_kwarg ___________________ 1550s 1550s self = 1550s 1550s def test_encoding_kwarg(self) -> None: 1550s ds = Dataset({"x": ("y", np.arange(10.0))}) 1550s 1550s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _______________ TestGenericNetCDFData.test_encoding_kwarg_dates ________________ 1550s 1550s self = 1550s 1550s def test_encoding_kwarg_dates(self) -> None: 1550s ds = Dataset({"t": pd.date_range("2000-01-01", periods=3)}) 1550s units = "days since 1900-01-01" 1550s kwargs = dict(encoding={"t": {"units": units}}) 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1302: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _________ TestGenericNetCDFData.test_encoding_kwarg_fixed_width_string _________ 1550s 1550s self = 1550s 1550s def test_encoding_kwarg_fixed_width_string(self) -> None: 1550s # regression test for GH2149 1550s for strings in [[b"foo", b"bar", b"baz"], ["foo", "bar", "baz"]]: 1550s ds = Dataset({"x": strings}) 1550s kwargs = dict(encoding={"x": {"dtype": "S1"}}) 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1311: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ________________ TestGenericNetCDFData.test_default_fill_value _________________ 1550s 1550s self = 1550s 1550s def test_default_fill_value(self) -> None: 1550s # Test default encoding for float: 1550s ds = Dataset({"x": ("y", np.arange(10.0))}) 1550s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ____________ TestGenericNetCDFData.test_explicitly_omit_fill_value _____________ 1550s 1550s self = 1550s 1550s def test_explicitly_omit_fill_value(self) -> None: 1550s ds = Dataset({"x": ("y", [np.pi, -np.pi])}) 1550s ds.x.encoding["_FillValue"] = None 1550s > with self.roundtrip(ds) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1341: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ___ TestGenericNetCDFData.test_explicitly_omit_fill_value_via_encoding_kwarg ___ 1550s 1550s self = 1550s 1550s def test_explicitly_omit_fill_value_via_encoding_kwarg(self) -> None: 1550s ds = Dataset({"x": ("y", [np.pi, -np.pi])}) 1550s kwargs = dict(encoding={"x": {"_FillValue": None}}) 1550s # _FillValue is not a valid encoding for Zarr 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1348: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ________ TestGenericNetCDFData.test_explicitly_omit_fill_value_in_coord ________ 1550s 1550s self = 1550s 1550s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1550s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1550s ds.y.encoding["_FillValue"] = None 1550s > with self.roundtrip(ds) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestGenericNetCDFData.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg _ 1550s 1550s self = 1550s 1550s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1550s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1550s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ________________ TestGenericNetCDFData.test_encoding_same_dtype ________________ 1550s 1550s self = 1550s 1550s def test_encoding_same_dtype(self) -> None: 1550s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1550s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1550s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ___________________ TestGenericNetCDFData.test_append_write ____________________ 1550s 1550s self = 1550s 1550s def test_append_write(self) -> None: 1550s # regression for GH1215 1550s data = create_test_data() 1550s > with self.roundtrip_append(data) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:389: in roundtrip_append 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ______________ TestGenericNetCDFData.test_append_overwrite_values ______________ 1550s 1550s self = 1550s 1550s def test_append_overwrite_values(self) -> None: 1550s # regression for GH1215 1550s data = create_test_data() 1550s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1550s self.save(data, tmp_file, mode="w") 1550s data["var2"][:] = -999 1550s data["var9"] = data["var2"] * 3 1550s self.save(data[["var2", "var9"]], tmp_file, mode="a") 1550s > with self.open(tmp_file) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1388: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ____________ TestGenericNetCDFData.test_multiindex_not_implemented _____________ 1550s 1550s self = 1550s 1550s def test_multiindex_not_implemented(self) -> None: 1550s ds = Dataset(coords={"y": ("x", [1, 2]), "z": ("x", ["a", "b"])}).set_index( 1550s x=["y", "z"] 1550s ) 1550s with pytest.raises(NotImplementedError, match=r"MultiIndex"): 1550s with self.roundtrip(ds): 1550s pass 1550s 1550s # regression GH8628 (can serialize reset multi-index level coordinates) 1550s ds_reset = ds.reset_index("x") 1550s > with self.roundtrip(ds_reset) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1412: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _______________ TestGenericNetCDFData.test_string_object_warning _______________ 1550s 1550s self = 1550s 1550s @requires_dask 1550s def test_string_object_warning(self) -> None: 1550s original = Dataset( 1550s { 1550s "x": ( 1550s [ 1550s "y", 1550s ], 1550s np.array(["foo", "bar"], dtype=object), 1550s ) 1550s } 1550s ).chunk() 1550s with pytest.warns(SerializationWarning, match="dask array with dtype=object"): 1550s > with self.roundtrip(original) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1428: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s ______________ TestGenericNetCDFData.test_encoding_unlimited_dims ______________ 1550s 1550s self = 1550s 1550s def test_encoding_unlimited_dims(self) -> None: 1550s ds = Dataset({"x": ("y", np.arange(10.0))}) 1550s > with self.roundtrip(ds, save_kwargs=dict(unlimited_dims=["y"])) as actual: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4046: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1550s with self.open(path, **open_kwargs) as ds: 1550s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1550s return next(self.gen) 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1550s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-all-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'all', join = 'outer' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'outer' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'outer' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'outer' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-different-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'different', join = 'outer' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'outer' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-all-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'all', join = 'inner' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'inner' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'inner' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'inner' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-different-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'different', join = 'inner' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-different-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'inner' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-all-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'all', join = 'left' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-all-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'left' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-minimal-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'left' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-minimal-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'left' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-different-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'different', join = 'left' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-different-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'left' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-all-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'all', join = 'right' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-all-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'right' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-minimal-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'right' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-minimal-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'right' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-different-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'different', join = 'right' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-different-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'right' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1550s def test_open_mfdataset_does_same_as_concat( 1550s self, combine, concat_dim, opt, join 1550s ) -> None: 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[drop] _ 1550s 1550s self = 1550s combine_attrs = 'drop', attrs = [{'a': 1}, {'a': 2}], expected = {} 1550s expect_error = False 1550s 1550s @pytest.mark.parametrize( 1550s ["combine_attrs", "attrs", "expected", "expect_error"], 1550s ( 1550s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1550s pytest.param( 1550s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1550s ), 1550s pytest.param( 1550s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1550s ), 1550s pytest.param( 1550s "identical", 1550s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1550s None, 1550s True, 1550s id="identical", 1550s ), 1550s pytest.param( 1550s "drop_conflicts", 1550s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1550s {"a": 1, "c": 3}, 1550s False, 1550s id="drop_conflicts", 1550s ), 1550s ), 1550s ) 1550s def test_open_mfdataset_dataset_combine_attrs( 1550s self, combine_attrs, attrs, expected, expect_error 1550s ): 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[override] _ 1550s 1550s self = 1550s combine_attrs = 'override', attrs = [{'a': 1}, {'a': 2}], expected = {'a': 1} 1550s expect_error = False 1550s 1550s @pytest.mark.parametrize( 1550s ["combine_attrs", "attrs", "expected", "expect_error"], 1550s ( 1550s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1550s pytest.param( 1550s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1550s ), 1550s pytest.param( 1550s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1550s ), 1550s pytest.param( 1550s "identical", 1550s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1550s None, 1550s True, 1550s id="identical", 1550s ), 1550s pytest.param( 1550s "drop_conflicts", 1550s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1550s {"a": 1, "c": 3}, 1550s False, 1550s id="drop_conflicts", 1550s ), 1550s ), 1550s ) 1550s def test_open_mfdataset_dataset_combine_attrs( 1550s self, combine_attrs, attrs, expected, expect_error 1550s ): 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[no_conflicts] _ 1550s 1550s self = 1550s combine_attrs = 'no_conflicts', attrs = [{'a': 1}, {'a': 2}], expected = None 1550s expect_error = True 1550s 1550s @pytest.mark.parametrize( 1550s ["combine_attrs", "attrs", "expected", "expect_error"], 1550s ( 1550s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1550s pytest.param( 1550s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1550s ), 1550s pytest.param( 1550s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1550s ), 1550s pytest.param( 1550s "identical", 1550s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1550s None, 1550s True, 1550s id="identical", 1550s ), 1550s pytest.param( 1550s "drop_conflicts", 1550s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1550s {"a": 1, "c": 3}, 1550s False, 1550s id="drop_conflicts", 1550s ), 1550s ), 1550s ) 1550s def test_open_mfdataset_dataset_combine_attrs( 1550s self, combine_attrs, attrs, expected, expect_error 1550s ): 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[identical] _ 1550s 1550s self = 1550s combine_attrs = 'identical', attrs = [{'a': 1, 'b': 2}, {'a': 1, 'c': 3}] 1550s expected = None, expect_error = True 1550s 1550s @pytest.mark.parametrize( 1550s ["combine_attrs", "attrs", "expected", "expect_error"], 1550s ( 1550s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1550s pytest.param( 1550s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1550s ), 1550s pytest.param( 1550s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1550s ), 1550s pytest.param( 1550s "identical", 1550s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1550s None, 1550s True, 1550s id="identical", 1550s ), 1550s pytest.param( 1550s "drop_conflicts", 1550s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1550s {"a": 1, "c": 3}, 1550s False, 1550s id="drop_conflicts", 1550s ), 1550s ), 1550s ) 1550s def test_open_mfdataset_dataset_combine_attrs( 1550s self, combine_attrs, attrs, expected, expect_error 1550s ): 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[drop_conflicts] _ 1550s 1550s self = 1550s combine_attrs = 'drop_conflicts', attrs = [{'a': 1, 'b': 2}, {'b': -1, 'c': 3}] 1550s expected = {'a': 1, 'c': 3}, expect_error = False 1550s 1550s @pytest.mark.parametrize( 1550s ["combine_attrs", "attrs", "expected", "expect_error"], 1550s ( 1550s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1550s pytest.param( 1550s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1550s ), 1550s pytest.param( 1550s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1550s ), 1550s pytest.param( 1550s "identical", 1550s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1550s None, 1550s True, 1550s id="identical", 1550s ), 1550s pytest.param( 1550s "drop_conflicts", 1550s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1550s {"a": 1, "c": 3}, 1550s False, 1550s id="drop_conflicts", 1550s ), 1550s ), 1550s ) 1550s def test_open_mfdataset_dataset_combine_attrs( 1550s self, combine_attrs, attrs, expected, expect_error 1550s ): 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_attr_by_coords _ 1550s 1550s self = 1550s 1550s def test_open_mfdataset_dataset_attr_by_coords(self) -> None: 1550s """ 1550s Case when an attribute differs across the multiple files 1550s """ 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4725: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataarray_attr_by_coords _ 1550s 1550s self = 1550s 1550s def test_open_mfdataset_dataarray_attr_by_coords(self) -> None: 1550s """ 1550s Case when an attribute of a member DataArray differs across the multiple files 1550s """ 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # Give the files an inconsistent attribute 1550s for i, f in enumerate(files): 1550s > ds = open_dataset(f).load() 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4740: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[all-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'all' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s def test_open_mfdataset_exact_join_raises_error( 1550s self, combine, concat_dim, opt 1550s ) -> None: 1550s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s with pytest.raises( 1550s ValueError, match=r"cannot align objects.*join.*exact.*" 1550s ): 1550s > open_mfdataset( 1550s files, 1550s data_vars=opt, 1550s combine=combine, 1550s concat_dim=concat_dim, 1550s join="exact", 1550s ) 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[all-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'all' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s def test_open_mfdataset_exact_join_raises_error( 1550s self, combine, concat_dim, opt 1550s ) -> None: 1550s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s with pytest.raises( 1550s ValueError, match=r"cannot align objects.*join.*exact.*" 1550s ): 1550s > open_mfdataset( 1550s files, 1550s data_vars=opt, 1550s combine=combine, 1550s concat_dim=concat_dim, 1550s join="exact", 1550s ) 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[minimal-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'minimal' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s def test_open_mfdataset_exact_join_raises_error( 1550s self, combine, concat_dim, opt 1550s ) -> None: 1550s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s with pytest.raises( 1550s ValueError, match=r"cannot align objects.*join.*exact.*" 1550s ): 1550s > open_mfdataset( 1550s files, 1550s data_vars=opt, 1550s combine=combine, 1550s concat_dim=concat_dim, 1550s join="exact", 1550s ) 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[minimal-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'minimal' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s def test_open_mfdataset_exact_join_raises_error( 1550s self, combine, concat_dim, opt 1550s ) -> None: 1550s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s with pytest.raises( 1550s ValueError, match=r"cannot align objects.*join.*exact.*" 1550s ): 1550s > open_mfdataset( 1550s files, 1550s data_vars=opt, 1550s combine=combine, 1550s concat_dim=concat_dim, 1550s join="exact", 1550s ) 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[different-nested-t] _ 1550s 1550s self = 1550s combine = 'nested', concat_dim = 't', opt = 'different' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s def test_open_mfdataset_exact_join_raises_error( 1550s self, combine, concat_dim, opt 1550s ) -> None: 1550s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s with pytest.raises( 1550s ValueError, match=r"cannot align objects.*join.*exact.*" 1550s ): 1550s > open_mfdataset( 1550s files, 1550s data_vars=opt, 1550s combine=combine, 1550s concat_dim=concat_dim, 1550s join="exact", 1550s ) 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[different-by_coords-None] _ 1550s 1550s self = 1550s combine = 'by_coords', concat_dim = None, opt = 'different' 1550s 1550s @pytest.mark.parametrize( 1550s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1550s ) 1550s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1550s def test_open_mfdataset_exact_join_raises_error( 1550s self, combine, concat_dim, opt 1550s ) -> None: 1550s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1550s if combine == "by_coords": 1550s files.reverse() 1550s with pytest.raises( 1550s ValueError, match=r"cannot align objects.*join.*exact.*" 1550s ): 1550s > open_mfdataset( 1550s files, 1550s data_vars=opt, 1550s combine=combine, 1550s concat_dim=concat_dim, 1550s join="exact", 1550s ) 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_common_coord_when_datavars_all _ 1550s 1550s self = 1550s 1550s def test_common_coord_when_datavars_all(self) -> None: 1550s opt: Final = "all" 1550s 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # open the files with the data_var option 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine="nested", concat_dim="t" 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4774: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_common_coord_when_datavars_minimal _ 1550s 1550s self = 1550s 1550s def test_common_coord_when_datavars_minimal(self) -> None: 1550s opt: Final = "minimal" 1550s 1550s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1550s # open the files using data_vars option 1550s > with open_mfdataset( 1550s files, data_vars=opt, combine="nested", concat_dim="t" 1550s ) as ds: 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4792: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1550s datasets = [open_(p, **open_kwargs) for p in paths1d] 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1550s backend_ds = backend.open_dataset( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1550s store = NetCDF4DataStore.open( 1550s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1550s import netCDF4 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s 1550s # init for netCDF4. package 1550s # Docstring comes from extension module _netCDF4. 1550s > from ._netCDF4 import * 1550s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1550s 1550s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1550s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_invalid_data_vars_value_should_fail _ 1550s 1550s self = 1550s 1550s def test_invalid_data_vars_value_should_fail(self) -> None: 1550s with self.setup_files_and_datasets() as (files, _): 1550s with pytest.raises(ValueError): 1550s > with open_mfdataset(files, data_vars="minimum", combine="by_coords"): # type: ignore[arg-type] 1550s 1550s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4808: 1550s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1550s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1551s datasets = [open_(p, **open_kwargs) for p in paths1d] 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ____________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_no_name ____________ 1551s 1551s self = 1551s 1551s def test_dataarray_to_netcdf_no_name(self) -> None: 1551s original_da = DataArray(np.arange(12).reshape((3, 4))) 1551s 1551s with create_tmp_file() as tmp: 1551s original_da.to_netcdf(tmp) 1551s 1551s > with open_dataarray(tmp) as loaded_da: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5576: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1551s dataset = open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_with_name ___________ 1551s 1551s self = 1551s 1551s def test_dataarray_to_netcdf_with_name(self) -> None: 1551s original_da = DataArray(np.arange(12).reshape((3, 4)), name="test") 1551s 1551s with create_tmp_file() as tmp: 1551s original_da.to_netcdf(tmp) 1551s 1551s > with open_dataarray(tmp) as loaded_da: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5585: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1551s dataset = open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _______ TestDataArrayToNetCDF.test_dataarray_to_netcdf_coord_name_clash ________ 1551s 1551s self = 1551s 1551s def test_dataarray_to_netcdf_coord_name_clash(self) -> None: 1551s original_da = DataArray( 1551s np.arange(12).reshape((3, 4)), dims=["x", "y"], name="x" 1551s ) 1551s 1551s with create_tmp_file() as tmp: 1551s original_da.to_netcdf(tmp) 1551s 1551s > with open_dataarray(tmp) as loaded_da: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5596: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1551s dataset = open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________ TestDataArrayToNetCDF.test_open_dataarray_options _______________ 1551s 1551s self = 1551s 1551s def test_open_dataarray_options(self) -> None: 1551s data = DataArray(np.arange(5), coords={"y": ("x", range(5))}, dims=["x"]) 1551s 1551s with create_tmp_file() as tmp: 1551s data.to_netcdf(tmp) 1551s 1551s expected = data.drop_vars("y") 1551s > with open_dataarray(tmp, drop_variables=["y"]) as loaded: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5606: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1551s dataset = open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_no_name_pathlib ________ 1551s 1551s self = 1551s 1551s def test_dataarray_to_netcdf_no_name_pathlib(self) -> None: 1551s original_da = DataArray(np.arange(12).reshape((3, 4))) 1551s 1551s with create_tmp_file() as tmps: 1551s tmp = Path(tmps) 1551s original_da.to_netcdf(tmp) 1551s 1551s > with open_dataarray(tmp) as loaded_da: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5623: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1551s dataset = open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_source_encoding_always_present ______________________ 1551s 1551s @requires_scipy_or_netCDF4 1551s def test_source_encoding_always_present() -> None: 1551s # Test for GH issue #2550. 1551s rnddata = np.random.randn(10) 1551s original = Dataset({"foo": ("x", rnddata)}) 1551s with create_tmp_file() as tmp: 1551s original.to_netcdf(tmp) 1551s > with open_dataset(tmp) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5703: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _______________ test_source_encoding_always_present_with_pathlib _______________ 1551s 1551s @requires_scipy_or_netCDF4 1551s def test_source_encoding_always_present_with_pathlib() -> None: 1551s # Test for GH issue #5888. 1551s rnddata = np.random.randn(10) 1551s original = Dataset({"foo": ("x", rnddata)}) 1551s with create_tmp_file() as tmp: 1551s original.to_netcdf(tmp) 1551s > with open_dataset(Path(tmp)) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5714: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ________ test_use_cftime_standard_calendar_default_in_range[gregorian] _________ 1551s 1551s calendar = 'gregorian' 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 1551s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units_date = "2000-01-01" 1551s units = "days since 2000-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s x_timedeltas = np.array(x).astype("timedelta64[D]") 1551s time_timedeltas = np.array(time).astype("timedelta64[D]") 1551s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 1551s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s > with open_dataset(tmp_file) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___ test_use_cftime_standard_calendar_default_in_range[proleptic_gregorian] ____ 1551s 1551s calendar = 'proleptic_gregorian' 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 1551s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units_date = "2000-01-01" 1551s units = "days since 2000-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s x_timedeltas = np.array(x).astype("timedelta64[D]") 1551s time_timedeltas = np.array(time).astype("timedelta64[D]") 1551s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 1551s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s > with open_dataset(tmp_file) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _________ test_use_cftime_standard_calendar_default_in_range[standard] _________ 1551s 1551s calendar = 'standard' 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 1551s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units_date = "2000-01-01" 1551s units = "days since 2000-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s x_timedeltas = np.array(x).astype("timedelta64[D]") 1551s time_timedeltas = np.array(time).astype("timedelta64[D]") 1551s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 1551s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s > with open_dataset(tmp_file) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _______ test_use_cftime_standard_calendar_default_out_of_range[standard] _______ 1551s 1551s calendar = 'standard' 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1551s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1551s # todo: check, if we still need to test for two dates 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = "days since 1582-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.warns(SerializationWarning): 1551s > with open_dataset(tmp_file) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5794: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s 1551s During handling of the above exception, another exception occurred: 1551s 1551s calendar = 'standard' 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1551s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1551s # todo: check, if we still need to test for two dates 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = "days since 1582-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s > with pytest.warns(SerializationWarning): 1551s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 1551s E Emitted warnings: []. 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5793: Failed 1551s ______ test_use_cftime_standard_calendar_default_out_of_range[gregorian] _______ 1551s 1551s calendar = 'gregorian' 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1551s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1551s # todo: check, if we still need to test for two dates 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = "days since 1582-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.warns(SerializationWarning): 1551s > with open_dataset(tmp_file) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5794: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s 1551s During handling of the above exception, another exception occurred: 1551s 1551s calendar = 'gregorian' 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1551s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1551s # todo: check, if we still need to test for two dates 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = "days since 1582-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s > with pytest.warns(SerializationWarning): 1551s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 1551s E Emitted warnings: []. 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5793: Failed 1551s ______________________ test_use_cftime_true[1500-360_day] ______________________ 1551s 1551s calendar = '360_day', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[1500-365_day] ______________________ 1551s 1551s calendar = '365_day', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[1500-366_day] ______________________ 1551s 1551s calendar = '366_day', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[1500-all_leap] ______________________ 1551s 1551s calendar = 'all_leap', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[1500-gregorian] _____________________ 1551s 1551s calendar = 'gregorian', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[1500-julian] _______________________ 1551s 1551s calendar = 'julian', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[1500-noleap] _______________________ 1551s 1551s calendar = 'noleap', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ________________ test_use_cftime_true[1500-proleptic_gregorian] ________________ 1551s 1551s calendar = 'proleptic_gregorian', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[1500-standard] ______________________ 1551s 1551s calendar = 'standard', units_year = 1500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2000-360_day] ______________________ 1551s 1551s calendar = '360_day', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2000-365_day] ______________________ 1551s 1551s calendar = '365_day', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2000-366_day] ______________________ 1551s 1551s calendar = '366_day', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[2000-all_leap] ______________________ 1551s 1551s calendar = 'all_leap', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[2000-gregorian] _____________________ 1551s 1551s calendar = 'gregorian', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2000-julian] _______________________ 1551s 1551s calendar = 'julian', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2000-noleap] _______________________ 1551s 1551s calendar = 'noleap', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ________________ test_use_cftime_true[2000-proleptic_gregorian] ________________ 1551s 1551s calendar = 'proleptic_gregorian', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[2000-standard] ______________________ 1551s 1551s calendar = 'standard', units_year = 2000 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2500-360_day] ______________________ 1551s 1551s calendar = '360_day', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2500-365_day] ______________________ 1551s 1551s calendar = '365_day', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2500-366_day] ______________________ 1551s 1551s calendar = '366_day', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[2500-all_leap] ______________________ 1551s 1551s calendar = 'all_leap', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[2500-gregorian] _____________________ 1551s 1551s calendar = 'gregorian', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2500-julian] _______________________ 1551s 1551s calendar = 'julian', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________ test_use_cftime_true[2500-noleap] _______________________ 1551s 1551s calendar = 'noleap', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ________________ test_use_cftime_true[2500-proleptic_gregorian] ________________ 1551s 1551s calendar = 'proleptic_gregorian', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _____________________ test_use_cftime_true[2500-standard] ______________________ 1551s 1551s calendar = 'standard', units_year = 2500 1551s 1551s @requires_cftime 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_true(calendar, units_year) -> None: 1551s import cftime 1551s 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1551s decoded_time = cftime.num2date( 1551s time, units, calendar, only_use_cftime_datetimes=True 1551s ) 1551s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1551s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with warnings.catch_warnings(record=True) as record: 1551s decoder = CFDatetimeCoder(use_cftime=True) 1551s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ________ test_use_cftime_false_standard_calendar_out_of_range[standard] ________ 1551s 1551s calendar = 'standard' 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1551s def test_use_cftime_false_standard_calendar_out_of_range(calendar) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = "days since 1582-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5877: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s _______ test_use_cftime_false_standard_calendar_out_of_range[gregorian] ________ 1551s 1551s calendar = 'gregorian' 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1551s def test_use_cftime_false_standard_calendar_out_of_range(calendar) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = "days since 1582-01-01" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5877: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[1500-360_day] ___________ 1551s 1551s calendar = '360_day', units_year = 1500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[1500-365_day] ___________ 1551s 1551s calendar = '365_day', units_year = 1500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[1500-366_day] ___________ 1551s 1551s calendar = '366_day', units_year = 1500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s __________ test_use_cftime_false_nonstandard_calendar[1500-all_leap] ___________ 1551s 1551s calendar = 'all_leap', units_year = 1500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[1500-julian] ____________ 1551s 1551s calendar = 'julian', units_year = 1500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[1500-noleap] ____________ 1551s 1551s calendar = 'noleap', units_year = 1500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2000-360_day] ___________ 1551s 1551s calendar = '360_day', units_year = 2000 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2000-365_day] ___________ 1551s 1551s calendar = '365_day', units_year = 2000 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2000-366_day] ___________ 1551s 1551s calendar = '366_day', units_year = 2000 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s __________ test_use_cftime_false_nonstandard_calendar[2000-all_leap] ___________ 1551s 1551s calendar = 'all_leap', units_year = 2000 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2000-julian] ____________ 1551s 1551s calendar = 'julian', units_year = 2000 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2000-noleap] ____________ 1551s 1551s calendar = 'noleap', units_year = 2000 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2500-360_day] ___________ 1551s 1551s calendar = '360_day', units_year = 2500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2500-365_day] ___________ 1551s 1551s calendar = '365_day', units_year = 2500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2500-366_day] ___________ 1551s 1551s calendar = '366_day', units_year = 2500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s __________ test_use_cftime_false_nonstandard_calendar[2500-all_leap] ___________ 1551s 1551s calendar = 'all_leap', units_year = 2500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2500-julian] ____________ 1551s 1551s calendar = 'julian', units_year = 2500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ___________ test_use_cftime_false_nonstandard_calendar[2500-noleap] ____________ 1551s 1551s calendar = 'noleap', units_year = 2500 1551s 1551s @requires_scipy_or_netCDF4 1551s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1551s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1551s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1551s x = [0, 1] 1551s time = [0, 720] 1551s units = f"days since {units_year}" 1551s original = DataArray(x, [("time", time)], name="x").to_dataset() 1551s for v in ["x", "time"]: 1551s original[v].attrs["units"] = units 1551s original[v].attrs["calendar"] = calendar 1551s 1551s with create_tmp_file() as tmp_file: 1551s original.to_netcdf(tmp_file) 1551s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1551s decoder = CFDatetimeCoder(use_cftime=False) 1551s > open_dataset(tmp_file, decode_times=decoder) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ____________________ test_open_dataset_chunking_zarr[auto] _____________________ 1551s 1551s chunks = 'auto' 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar0') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1551s encoded_chunks = 100 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s _____________________ test_open_dataset_chunking_zarr[-1] ______________________ 1551s 1551s chunks = -1 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar1') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1551s encoded_chunks = 100 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___________________ test_open_dataset_chunking_zarr[chunks2] ___________________ 1551s 1551s chunks = {} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar2') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1551s encoded_chunks = 100 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___________________ test_open_dataset_chunking_zarr[chunks3] ___________________ 1551s 1551s chunks = {'x': 'auto'} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar3') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1551s encoded_chunks = 100 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___________________ test_open_dataset_chunking_zarr[chunks4] ___________________ 1551s 1551s chunks = {'x': -1} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar4') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1551s encoded_chunks = 100 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___________________ test_open_dataset_chunking_zarr[chunks5] ___________________ 1551s 1551s chunks = {'x': 'auto', 'y': -1} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar5') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1551s encoded_chunks = 100 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s _______________________ test_chunking_consintency[auto] ________________________ 1551s 1551s chunks = 'auto' 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_auto0') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1551s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1551s encoded_chunks: dict[str, Any] = {} 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s ds.to_netcdf(tmp_path / "test.nc") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with xr.open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ________________________ test_chunking_consintency[-1] _________________________ 1551s 1551s chunks = -1 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency__1_0') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1551s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1551s encoded_chunks: dict[str, Any] = {} 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s ds.to_netcdf(tmp_path / "test.nc") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with xr.open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ______________________ test_chunking_consintency[chunks2] ______________________ 1551s 1551s chunks = {} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun0') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1551s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1551s encoded_chunks: dict[str, Any] = {} 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s ds.to_netcdf(tmp_path / "test.nc") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with xr.open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ______________________ test_chunking_consintency[chunks3] ______________________ 1551s 1551s chunks = {'x': 'auto'} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun1') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1551s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1551s encoded_chunks: dict[str, Any] = {} 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s ds.to_netcdf(tmp_path / "test.nc") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with xr.open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ______________________ test_chunking_consintency[chunks4] ______________________ 1551s 1551s chunks = {'x': -1} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun2') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1551s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1551s encoded_chunks: dict[str, Any] = {} 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s ds.to_netcdf(tmp_path / "test.nc") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with xr.open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ______________________ test_chunking_consintency[chunks5] ______________________ 1551s 1551s chunks = {'x': 'auto', 'y': -1} 1551s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun3') 1551s 1551s @requires_zarr 1551s @requires_dask 1551s @pytest.mark.parametrize( 1551s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1551s ) 1551s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1551s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1551s encoded_chunks: dict[str, Any] = {} 1551s dask_arr = da.from_array( 1551s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1551s ) 1551s ds = xr.Dataset( 1551s { 1551s "test": xr.DataArray( 1551s dask_arr, 1551s dims=("x", "y"), 1551s ) 1551s } 1551s ) 1551s ds["test"].encoding["chunks"] = encoded_chunks 1551s ds.to_zarr(tmp_path / "test.zarr") 1551s ds.to_netcdf(tmp_path / "test.nc") 1551s 1551s with dask.config.set({"array.chunk-size": "1MiB"}): 1551s expected = ds.chunk(chunks) 1551s > with xr.open_dataset( 1551s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1551s ) as actual: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1551s ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'test' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ________________ TestZarrDatatreeIO.test_to_zarr[zarr_format=3] ________________ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zarr_format_3_0') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s zarr_format = 3 1551s 1551s def test_to_zarr(self, tmpdir, simple_datatree, zarr_format): 1551s filepath = str(tmpdir / "test.zarr") 1551s original_dt = simple_datatree 1551s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1551s 1551s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:459: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s _____________ TestZarrDatatreeIO.test_zarr_encoding[zarr_format=3] _____________ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_zarr_encoding_zarr_format1') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s zarr_format = 3 1551s 1551s def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format): 1551s filepath = str(tmpdir / "test.zarr") 1551s original_dt = simple_datatree 1551s 1551s if zarr_format == 2: 1551s from numcodecs.blosc import Blosc 1551s 1551s codec = Blosc(cname="zstd", clevel=3, shuffle=2) 1551s comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec} 1551s elif zarr_format == 3: 1551s # specifying codecs in zarr_format=3 requires importing from zarr 3 namespace 1551s import numcodecs.zarr3 1551s 1551s comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)} 1551s 1551s enc = {"/set2": {var: comp for var in original_dt["/set2"].dataset.data_vars}} 1551s original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format) 1551s 1551s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:480: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=2] ___________ 1551s 1551s cls = 1551s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1551s path = '', mode = 'r' 1551s 1551s @classmethod 1551s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1551s """ 1551s Open StorePath based on the provided mode. 1551s 1551s * If the mode is None, return an opened version of the store with no changes. 1551s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1551s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1551s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1551s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1551s 1551s Parameters 1551s ---------- 1551s mode : AccessModeLiteral 1551s The mode to use when initializing the store path. 1551s 1551s The accepted values are: 1551s 1551s - ``'r'``: read only (must exist) 1551s - ``'r+'``: read/write (must exist) 1551s - ``'a'``: read/write (create if doesn't exist) 1551s - ``'w'``: read/write (overwrite if exists) 1551s - ``'w-'``: read/write (create if doesn't exist). 1551s 1551s Raises 1551s ------ 1551s FileExistsError 1551s If the mode is 'w-' and the store path already exists. 1551s ValueError 1551s If the mode is not "r" and the store is read-only, or 1551s """ 1551s 1551s # fastpath if mode is None 1551s if mode is None: 1551s return await cls._create_open_instance(store, path) 1551s 1551s if mode not in ANY_ACCESS_MODE: 1551s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1551s 1551s if store.read_only: 1551s # Don't allow write operations on a read-only store 1551s if mode != "r": 1551s raise ValueError( 1551s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1551s ) 1551s self = await cls._create_open_instance(store, path) 1551s elif mode == "r": 1551s # Create read-only copy for read mode on writable store 1551s try: 1551s > read_only_store = store.with_read_only(True) 1551s 1551s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1551s read_only = True 1551s 1551s def with_read_only(self, read_only: bool = False) -> Store: 1551s """ 1551s Return a new store with a new read_only setting. 1551s 1551s The new store points to the same location with the specified new read_only state. 1551s The returned Store is not automatically opened, and this store is 1551s not automatically closed. 1551s 1551s Parameters 1551s ---------- 1551s read_only 1551s If True, the store will be created in read-only mode. Defaults to False. 1551s 1551s Returns 1551s ------- 1551s A new store of the same type with the new read only attribute. 1551s """ 1551s > raise NotImplementedError( 1551s f"with_read_only is not implemented for the {type(self)} store type." 1551s ) 1551s E NotImplementedError: with_read_only is not implemented for the store type. 1551s 1551s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1551s 1551s The above exception was the direct cause of the following exception: 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s zarr_format = 2 1551s 1551s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1551s from zarr.storage import ZipStore 1551s 1551s filepath = str(tmpdir / "test.zarr.zip") 1551s original_dt = simple_datatree 1551s store = ZipStore(filepath, mode="w") 1551s original_dt.to_zarr(store, zarr_format=zarr_format) 1551s 1551s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1551s stores = ZarrStore.open_store( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1551s ) = _get_open_params( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1551s zarr_root_group = zarr.open_group(store, **open_kwargs) 1551s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1551s sync( 1551s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1551s raise return_result 1551s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1551s return await coro 1551s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1551s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1551s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1551s return await StorePath.open(store, path=path_normalized, mode=mode) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s cls = 1551s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1551s path = '', mode = 'r' 1551s 1551s @classmethod 1551s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1551s """ 1551s Open StorePath based on the provided mode. 1551s 1551s * If the mode is None, return an opened version of the store with no changes. 1551s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1551s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1551s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1551s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1551s 1551s Parameters 1551s ---------- 1551s mode : AccessModeLiteral 1551s The mode to use when initializing the store path. 1551s 1551s The accepted values are: 1551s 1551s - ``'r'``: read only (must exist) 1551s - ``'r+'``: read/write (must exist) 1551s - ``'a'``: read/write (create if doesn't exist) 1551s - ``'w'``: read/write (overwrite if exists) 1551s - ``'w-'``: read/write (create if doesn't exist). 1551s 1551s Raises 1551s ------ 1551s FileExistsError 1551s If the mode is 'w-' and the store path already exists. 1551s ValueError 1551s If the mode is not "r" and the store is read-only, or 1551s """ 1551s 1551s # fastpath if mode is None 1551s if mode is None: 1551s return await cls._create_open_instance(store, path) 1551s 1551s if mode not in ANY_ACCESS_MODE: 1551s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1551s 1551s if store.read_only: 1551s # Don't allow write operations on a read-only store 1551s if mode != "r": 1551s raise ValueError( 1551s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1551s ) 1551s self = await cls._create_open_instance(store, path) 1551s elif mode == "r": 1551s # Create read-only copy for read mode on writable store 1551s try: 1551s read_only_store = store.with_read_only(True) 1551s except NotImplementedError as e: 1551s > raise ValueError( 1551s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1551s "Please use a read-only store or a storage class that implements .with_read_only()." 1551s ) from e 1551s 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(). 1551s 1551s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1551s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=3] ___________ 1551s 1551s cls = 1551s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1551s path = '', mode = 'r' 1551s 1551s @classmethod 1551s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1551s """ 1551s Open StorePath based on the provided mode. 1551s 1551s * If the mode is None, return an opened version of the store with no changes. 1551s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1551s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1551s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1551s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1551s 1551s Parameters 1551s ---------- 1551s mode : AccessModeLiteral 1551s The mode to use when initializing the store path. 1551s 1551s The accepted values are: 1551s 1551s - ``'r'``: read only (must exist) 1551s - ``'r+'``: read/write (must exist) 1551s - ``'a'``: read/write (create if doesn't exist) 1551s - ``'w'``: read/write (overwrite if exists) 1551s - ``'w-'``: read/write (create if doesn't exist). 1551s 1551s Raises 1551s ------ 1551s FileExistsError 1551s If the mode is 'w-' and the store path already exists. 1551s ValueError 1551s If the mode is not "r" and the store is read-only, or 1551s """ 1551s 1551s # fastpath if mode is None 1551s if mode is None: 1551s return await cls._create_open_instance(store, path) 1551s 1551s if mode not in ANY_ACCESS_MODE: 1551s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1551s 1551s if store.read_only: 1551s # Don't allow write operations on a read-only store 1551s if mode != "r": 1551s raise ValueError( 1551s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1551s ) 1551s self = await cls._create_open_instance(store, path) 1551s elif mode == "r": 1551s # Create read-only copy for read mode on writable store 1551s try: 1551s > read_only_store = store.with_read_only(True) 1551s 1551s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1551s read_only = True 1551s 1551s def with_read_only(self, read_only: bool = False) -> Store: 1551s """ 1551s Return a new store with a new read_only setting. 1551s 1551s The new store points to the same location with the specified new read_only state. 1551s The returned Store is not automatically opened, and this store is 1551s not automatically closed. 1551s 1551s Parameters 1551s ---------- 1551s read_only 1551s If True, the store will be created in read-only mode. Defaults to False. 1551s 1551s Returns 1551s ------- 1551s A new store of the same type with the new read only attribute. 1551s """ 1551s > raise NotImplementedError( 1551s f"with_read_only is not implemented for the {type(self)} store type." 1551s ) 1551s E NotImplementedError: with_read_only is not implemented for the store type. 1551s 1551s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1551s 1551s The above exception was the direct cause of the following exception: 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s zarr_format = 3 1551s 1551s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1551s from zarr.storage import ZipStore 1551s 1551s filepath = str(tmpdir / "test.zarr.zip") 1551s original_dt = simple_datatree 1551s store = ZipStore(filepath, mode="w") 1551s original_dt.to_zarr(store, zarr_format=zarr_format) 1551s 1551s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1551s stores = ZarrStore.open_store( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1551s ) = _get_open_params( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1551s zarr_root_group = zarr.open_group(store, **open_kwargs) 1551s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1551s sync( 1551s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1551s raise return_result 1551s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1551s return await coro 1551s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1551s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1551s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1551s return await StorePath.open(store, path=path_normalized, mode=mode) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s cls = 1551s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1551s path = '', mode = 'r' 1551s 1551s @classmethod 1551s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1551s """ 1551s Open StorePath based on the provided mode. 1551s 1551s * If the mode is None, return an opened version of the store with no changes. 1551s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1551s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1551s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1551s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1551s 1551s Parameters 1551s ---------- 1551s mode : AccessModeLiteral 1551s The mode to use when initializing the store path. 1551s 1551s The accepted values are: 1551s 1551s - ``'r'``: read only (must exist) 1551s - ``'r+'``: read/write (must exist) 1551s - ``'a'``: read/write (create if doesn't exist) 1551s - ``'w'``: read/write (overwrite if exists) 1551s - ``'w-'``: read/write (create if doesn't exist). 1551s 1551s Raises 1551s ------ 1551s FileExistsError 1551s If the mode is 'w-' and the store path already exists. 1551s ValueError 1551s If the mode is not "r" and the store is read-only, or 1551s """ 1551s 1551s # fastpath if mode is None 1551s if mode is None: 1551s return await cls._create_open_instance(store, path) 1551s 1551s if mode not in ANY_ACCESS_MODE: 1551s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1551s 1551s if store.read_only: 1551s # Don't allow write operations on a read-only store 1551s if mode != "r": 1551s raise ValueError( 1551s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1551s ) 1551s self = await cls._create_open_instance(store, path) 1551s elif mode == "r": 1551s # Create read-only copy for read mode on writable store 1551s try: 1551s read_only_store = store.with_read_only(True) 1551s except NotImplementedError as e: 1551s > raise ValueError( 1551s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1551s "Please use a read-only store or a storage class that implements .with_read_only()." 1551s ) from e 1551s 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(). 1551s 1551s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1551s _______ TestZarrDatatreeIO.test_to_zarr_not_consolidated[zarr_format=3] ________ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_not_consolidated_1') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s zarr_format = 3 1551s 1551s def test_to_zarr_not_consolidated(self, tmpdir, simple_datatree, zarr_format): 1551s filepath = tmpdir / "test.zarr" 1551s zmetadata = filepath / ".zmetadata" 1551s s1zmetadata = filepath / "set1" / ".zmetadata" 1551s filepath = str(filepath) # casting to str avoids a pathlib bug in xarray 1551s original_dt = simple_datatree 1551s original_dt.to_zarr(filepath, consolidated=False, zarr_format=zarr_format) 1551s assert not zmetadata.exists() 1551s assert not s1zmetadata.exists() 1551s 1551s with pytest.warns(RuntimeWarning, match="consolidated"): 1551s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:514: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ________ TestZarrDatatreeIO.test_open_groups_round_trip[zarr_format=3] _________ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_groups_round_trip_za1') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s zarr_format = 3 1551s 1551s def test_open_groups_round_trip(self, tmpdir, simple_datatree, zarr_format) -> None: 1551s """Test `open_groups` opens a zarr store with the `simple_datatree` structure.""" 1551s filepath = str(tmpdir / "test.zarr") 1551s original_dt = simple_datatree 1551s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1551s 1551s > roundtrip_dict = open_groups(filepath, engine="zarr") 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:631: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1551s backend_groups = backend.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s _____________ TestZarrDatatreeIO.test_open_datatree[zarr_format=3] _____________ 1551s 1551s self = 1551s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xd82a1a78> 1551s zarr_format = 3 1551s 1551s @pytest.mark.filterwarnings( 1551s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1551s ) 1551s def test_open_datatree(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1551s """Test if `open_datatree` fails to open a zarr store with an unaligned group hierarchy.""" 1551s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1551s 1551s with pytest.raises( 1551s ValueError, 1551s match=( 1551s re.escape("group '/Group2' is not aligned with its parents:") + ".*" 1551s ), 1551s ): 1551s > open_datatree(storepath, engine="zarr") 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:653: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s _________ TestZarrDatatreeIO.test_open_datatree_chunks[zarr_format=3] __________ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_chunks_zarr1') 1551s zarr_format = 3 1551s 1551s @requires_dask 1551s def test_open_datatree_chunks(self, tmpdir, zarr_format) -> None: 1551s filepath = str(tmpdir / "test.zarr") 1551s 1551s chunks = {"x": 2, "y": 1} 1551s 1551s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1551s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1551s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1551s original_tree = DataTree.from_dict( 1551s { 1551s "/": root_data.chunk(chunks), 1551s "/group1": set1_data.chunk(chunks), 1551s "/group2": set2_data.chunk(chunks), 1551s } 1551s ) 1551s original_tree.to_zarr(filepath, zarr_format=zarr_format) 1551s 1551s > with open_datatree(filepath, engine="zarr", chunks=chunks) as tree: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:673: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ______________ TestZarrDatatreeIO.test_open_groups[zarr_format=3] ______________ 1551s 1551s self = 1551s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xd82a1a78> 1551s zarr_format = 3 1551s 1551s @pytest.mark.filterwarnings( 1551s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1551s ) 1551s def test_open_groups(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1551s """Test `open_groups` with a zarr store of an unaligned group hierarchy.""" 1551s 1551s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1551s > unaligned_dict_of_datasets = open_groups(storepath, engine="zarr") 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:689: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1551s backend_groups = backend.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[True-zarr_format=3] ___ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr1') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s write_consolidated_metadata = True, zarr_format = 3 1551s 1551s @pytest.mark.filterwarnings( 1551s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1551s ) 1551s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1551s def test_open_datatree_specific_group( 1551s self, 1551s tmpdir, 1551s simple_datatree, 1551s write_consolidated_metadata, 1551s zarr_format, 1551s ) -> None: 1551s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1551s filepath = str(tmpdir / "test.zarr") 1551s group = "/set2" 1551s original_dt = simple_datatree 1551s original_dt.to_zarr( 1551s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1551s ) 1551s expected_subtree = original_dt[group].copy() 1551s expected_subtree.orphan() 1551s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s __ TestZarrDatatreeIO.test_open_datatree_specific_group[False-zarr_format=3] ___ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr3') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s write_consolidated_metadata = False, zarr_format = 3 1551s 1551s @pytest.mark.filterwarnings( 1551s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1551s ) 1551s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1551s def test_open_datatree_specific_group( 1551s self, 1551s tmpdir, 1551s simple_datatree, 1551s write_consolidated_metadata, 1551s zarr_format, 1551s ) -> None: 1551s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1551s filepath = str(tmpdir / "test.zarr") 1551s group = "/set2" 1551s original_dt = simple_datatree 1551s original_dt.to_zarr( 1551s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1551s ) 1551s expected_subtree = original_dt[group].copy() 1551s expected_subtree.orphan() 1551s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[None-zarr_format=3] ___ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr5') 1551s simple_datatree = 1551s Group: / 1551s │ Dimensions: (y: 3, x: 2) 1551s │ Dimensions without coordinates: y, x 1551s │ Data variables: 1551s ... a (x) int32 8B 2 3 1551s │ │ b (x) float64 16B 0.1 0.2 1551s │ └── Group: /set2/set1 1551s └── Group: /set3 1551s write_consolidated_metadata = None, zarr_format = 3 1551s 1551s @pytest.mark.filterwarnings( 1551s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1551s ) 1551s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1551s def test_open_datatree_specific_group( 1551s self, 1551s tmpdir, 1551s simple_datatree, 1551s write_consolidated_metadata, 1551s zarr_format, 1551s ) -> None: 1551s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1551s filepath = str(tmpdir / "test.zarr") 1551s group = "/set2" 1551s original_dt = simple_datatree 1551s original_dt.to_zarr( 1551s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1551s ) 1551s expected_subtree = original_dt[group].copy() 1551s expected_subtree.orphan() 1551s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1551s backend_tree = backend.open_datatree( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1551s groups_dict = self.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s __________ TestZarrDatatreeIO.test_open_groups_chunks[zarr_format=3] ___________ 1551s 1551s self = 1551s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_groups_chunks_zarr_f1') 1551s zarr_format = 3 1551s 1551s @requires_dask 1551s def test_open_groups_chunks(self, tmpdir, zarr_format) -> None: 1551s """Test `open_groups` with chunks on a zarr store.""" 1551s 1551s chunks = {"x": 2, "y": 1} 1551s filepath = str(tmpdir / "test.zarr") 1551s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1551s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1551s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1551s original_tree = DataTree.from_dict( 1551s { 1551s "/": root_data.chunk(chunks), 1551s "/group1": set1_data.chunk(chunks), 1551s "/group2": set2_data.chunk(chunks), 1551s } 1551s ) 1551s original_tree.to_zarr(filepath, mode="w", zarr_format=zarr_format) 1551s 1551s > dict_of_datasets = open_groups(filepath, engine="zarr", chunks=chunks) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:752: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1551s backend_groups = backend.open_groups_as_dict( 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1551s group_ds = store_entrypoint.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1551s vars, attrs = filename_or_obj.load() 1551s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1551s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1551s return Frozen(dict(*args, **kwargs)) 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1551s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s self = , name = 'b' 1551s 1551s def open_store_variable(self, name): 1551s zarr_array = self.members[name] 1551s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1551s try_nczarr = self._mode == "r" 1551s dimensions, attributes = _get_zarr_dims_and_attrs( 1551s zarr_array, DIMENSION_KEY, try_nczarr 1551s ) 1551s attributes = dict(attributes) 1551s 1551s encoding = { 1551s "chunks": zarr_array.chunks, 1551s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1551s } 1551s 1551s if _zarr_v3(): 1551s encoding.update( 1551s { 1551s "compressors": zarr_array.compressors, 1551s "filters": zarr_array.filters, 1551s "shards": zarr_array.shards, 1551s } 1551s ) 1551s if self.zarr_group.metadata.zarr_format == 3: 1551s encoding.update({"serializer": zarr_array.serializer}) 1551s else: 1551s encoding.update( 1551s { 1551s "compressor": zarr_array.compressor, 1551s "filters": zarr_array.filters, 1551s } 1551s ) 1551s 1551s if self._use_zarr_fill_value_as_mask: 1551s # Setting this attribute triggers CF decoding for missing values 1551s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1551s if zarr_array.fill_value is not None: 1551s attributes["_FillValue"] = zarr_array.fill_value 1551s elif "_FillValue" in attributes: 1551s original_zarr_dtype = zarr_array.metadata.data_type 1551s attributes["_FillValue"] = FillValueCoder.decode( 1551s > attributes["_FillValue"], original_zarr_dtype.value 1551s ) 1551s E AttributeError: 'Float64' object has no attribute 'value' 1551s 1551s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1551s ______________________ test_normalize_token_with_backend _______________________ 1551s 1551s map_ds = Size: 7kB 1551s Dimensions: (x: 10, y: 20, z: 4) 1551s Coordinates: 1551s * x (x) int32 40B 0 1 2 3 4 5 6 7 8...B 1 1 1 1 1551s e (x, y) int32 800B 100 101 102 103 104 105 ... 124 125 126 127 128 1551s Attributes: 1551s test: test 1551s 1551s @requires_scipy_or_netCDF4 1551s def test_normalize_token_with_backend(map_ds): 1551s with create_tmp_file(allow_cleanup_failure=ON_WINDOWS) as tmp_file: 1551s map_ds.to_netcdf(tmp_file) 1551s > read = xr.open_dataset(tmp_file) 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_dask.py:1648: 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1551s backend_ds = backend.open_dataset( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1551s store = NetCDF4DataStore.open( 1551s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1551s import netCDF4 1551s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1551s 1551s # init for netCDF4. package 1551s # Docstring comes from extension module _netCDF4. 1551s > from ._netCDF4 import * 1551s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1551s 1551s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1551s ______________________________ test_list_engines _______________________________ 1551s 1551s def test_list_engines() -> None: 1551s from xarray.backends import list_engines 1551s 1551s engines = list_engines() 1551s assert list_engines.cache_info().currsize == 1 1551s 1551s assert ("scipy" in engines) == has_scipy 1551s > assert ("h5netcdf" in engines) == has_h5netcdf 1551s E AssertionError: assert ('h5netcdf' in {'h5netcdf': \n Open netCDF (.nc, .nc4 and .cdf) and most HDF5 files using h5netcdf in Xarr...in Xarray\n Learn more at https://docs.xarray.dev/en/stable/generated/xarray.backends.StoreBackendEntrypoint.html, ...}) == False 1551s 1551s /usr/lib/python3/dist-packages/xarray/tests/test_plugins.py:272: AssertionError 1551s =============================== warnings summary =============================== 1551s ../../../../usr/lib/python3/dist-packages/pyparsing/core.py:5637 1551s /usr/lib/python3/dist-packages/pyparsing/core.py:5637: SyntaxWarning: 'return' in a 'finally' block 1551s return f"{type(self).__name__}: {retString}" 1551s 1551s tests/test_backends.py: 539 warnings 1551s tests/test_backends_datatree.py: 15 warnings 1551s /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. 1551s warnings.warn( 1551s 1551s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1551s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1551s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends.py: 117 warnings 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1551s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1551s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends.py: 12 warnings 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 1551s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 1551s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends.py: 33 warnings 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends.py: 33 warnings 1551s /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. 1551s v3_unstable_dtype_warning(self) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1551s /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. 1551s super().__init__(**codec_config) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1551s /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. 1551s super().__init__(**codec_config) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: '.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: '.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/.zarray' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/.zarray' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/.zarray' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/.zarray' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/.zarray' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/.zarray' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/.zgroup' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/.zattrs' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/zarr.json' 1551s return self._open_to_write(zinfo, force_zip64=force_zip64) 1551s 1551s tests/test_conventions.py: 1 warning 1551s tests/test_rolling.py: 36 warnings 1551s /usr/lib/python3/dist-packages/xarray/core/duck_array_ops.py:237: RuntimeWarning: invalid value encountered in cast 1551s return data.astype(dtype, **kwargs) 1551s 1551s tests/test_dask.py: 12 warnings 1551s tests/test_units.py: 10 warnings 1551s /usr/lib/python3/dist-packages/numpy/_core/numeric.py:476: RuntimeWarning: invalid value encountered in cast 1551s multiarray.copyto(res, fill_value, casting='unsafe') 1551s 1551s tests/test_duck_array_ops.py::test_cftime_datetime_mean[True] 1551s /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. 1551s result = function(*args, **kwargs) 1551s 1551s tests/test_duck_array_wrapping.py::TestDataArrayMethods::test_astype[pint] 1551s /usr/lib/python3/dist-packages/pint/facets/numpy/quantity.py:88: RuntimeWarning: invalid value encountered in cast 1551s value = func(*args, **kwargs) 1551s 1551s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-compatible_unit-function_clip] 1551s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-identical_unit-function_clip] 1551s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int32-compatible_unit-function_clip] 1551s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int32-identical_unit-function_clip] 1551s /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) 1551s return conv.wrap(result, to_scalar=False) 1551s 1551s tests/test_units.py::TestDataArray::test_missing_value_filling[int32-method_ffill] 1551s tests/test_units.py::TestDataArray::test_missing_value_filling[int32-method_bfill] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2766: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py: 15 warnings 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2803: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataArray::test_dropna[int32] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2831: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataArray::test_isin[int32-no_unit] 1551s tests/test_units.py::TestDataArray::test_isin[int32-dimensionless] 1551s tests/test_units.py::TestDataArray::test_isin[int32-incompatible_unit] 1551s tests/test_units.py::TestDataArray::test_isin[int32-compatible_unit] 1551s tests/test_units.py::TestDataArray::test_isin[int32-identical_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2856: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataArray::test_isin[int32-no_unit] 1551s tests/test_units.py::TestDataArray::test_isin[int32-dimensionless] 1551s tests/test_units.py::TestDataArray::test_isin[int32-incompatible_unit] 1551s tests/test_units.py::TestDataArray::test_isin[int32-compatible_unit] 1551s tests/test_units.py::TestDataArray::test_isin[int32-identical_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2861: RuntimeWarning: invalid value encountered in cast 1551s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_ffill] 1551s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_bfill] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4252: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_ffill] 1551s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_bfill] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4256: RuntimeWarning: invalid value encountered in cast 1551s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1551s 1551s tests/test_units.py: 15 warnings 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4295: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py: 15 warnings 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4299: RuntimeWarning: invalid value encountered in cast 1551s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_dropna[int32] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4325: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_dropna[int32] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4329: RuntimeWarning: invalid value encountered in cast 1551s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_isin[int32-no_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-dimensionless] 1551s tests/test_units.py::TestDataset::test_isin[int32-incompatible_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-compatible_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-same_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4353: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_isin[int32-no_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-dimensionless] 1551s tests/test_units.py::TestDataset::test_isin[int32-incompatible_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-compatible_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-same_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4357: RuntimeWarning: invalid value encountered in cast 1551s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_isin[int32-no_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-dimensionless] 1551s tests/test_units.py::TestDataset::test_isin[int32-incompatible_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-compatible_unit] 1551s tests/test_units.py::TestDataset::test_isin[int32-same_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4362: RuntimeWarning: invalid value encountered in cast 1551s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_interpolate_na[int32] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4438: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_interpolate_na[int32] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4442: RuntimeWarning: invalid value encountered in cast 1551s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1551s 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-no_unit] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-dimensionless] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-incompatible_unit] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-compatible_unit] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-same_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4487: RuntimeWarning: invalid value encountered in cast 1551s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) * data_unit 1551s 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-no_unit] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-dimensionless] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-incompatible_unit] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-compatible_unit] 1551s tests/test_units.py::TestDataset::test_combine_first[int32-data-same_unit] 1551s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4490: RuntimeWarning: invalid value encountered in cast 1551s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) * data_unit 1551s 1551s tests/test_variable.py::TestIndexVariable::test_to_index_multiindex_level 1551s /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)`. 1551s ds = Dataset(coords={"x": midx}) 1551s 1551s tests/test_weighted.py::test_weighted_quantile_3D[None-True-q1-a] 1551s tests/test_weighted.py::test_weighted_quantile_3D[True-True-0.5-a] 1551s /usr/lib/python3/dist-packages/numpy/lib/_nanfunctions_impl.py:1617: RuntimeWarning: All-NaN slice encountered 1551s return fnb._ureduce(a, 1551s 1551s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 1551s =========================== short test summary info ============================ 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_store[3] - Attri... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_load[3] - AttributeErr... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - A... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - At... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_dropna[3] - AttributeE... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_bytes_with_fill_value[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - At... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_overwrite_values[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - Attrib... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - Attr... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - At... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - At... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_group[3] - AttributeEr... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_write[3] - Attr... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_not_set_raises[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - A... 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1551s FAILED tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_store[3] - ... 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_test_data[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_load[3] - Attribu... 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dataset_compute[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_object_dtype[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_float64_data[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_orthogonal_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing_negative_step[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_outer_indexing_reversed[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_isel_dataarray[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_array_type_after_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dropna[3] - Attri... 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_ondisk_after_print[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_bytes_with_fill_value[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value0-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value1-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3--1-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-255-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_coordinate_variables_after_dataset_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_kwarg[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_default_fill_value[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_same_dtype[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_overwrite_values[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_read_non_consolidated_warning[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_auto_chunk[3] - A... 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_manual_chunk[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_warning_on_bad_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_uneven_dask_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_shard_encoding[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-group1] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_compressor_encoding[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_group[3] - Attrib... 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_write[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_not_set_raises[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-U] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-S] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_check_encoding_is_consistent_after_append[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_new_variable[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_no_overwrite[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_compute_false_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_append_compute_false_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_no_warning_from_open_emptydim_with_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-None] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-r+] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-a] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_preexisting_override_metadata[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_chunksizes[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding_with_partial_dask_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_open_zarr_use_cftime[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_read_select_write[3] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_attributes[3-obj1] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1551s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zarr_fill_value_setting[3-float] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_store[3] - Attr... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_test_data[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_load[3] - AttributeEr... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dataset_compute[3] - ... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_object_dtype[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_float64_data[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_orthogonal_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing_negative_step[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_outer_indexing_reversed[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_isel_dataarray[3] - A... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_array_type_after_indexing[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dropna[3] - Attribute... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_ondisk_after_print[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_bytes_with_fill_value[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value0-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value1-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3--1-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-255-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_coordinate_variables_after_dataset_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_kwarg[3] - A... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_default_fill_value[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_same_dtype[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_overwrite_values[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_read_non_consolidated_warning[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_auto_chunk[3] - Attri... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_manual_chunk[3] - Att... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_warning_on_bad_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_uneven_dask_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding[3] - A... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_shard_encoding[3] - A... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-group1] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_compressor_encoding[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_group[3] - AttributeE... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_write[3] - Att... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_not_set_raises[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-U] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-S] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_check_encoding_is_consistent_after_append[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_new_variable[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_no_overwrite[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_compute_false_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_append_compute_false_roundtrip[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_no_warning_from_open_emptydim_with_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-r+] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-a] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_preexisting_override_metadata[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_chunksizes[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding_with_partial_dask_chunks[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_open_zarr_use_cftime[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_read_select_write[3] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_attributes[3-obj1] - ... 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zarr_fill_value_setting[3-float] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-None] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-True] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-False] 1551s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-None] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-full-auto] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-mixed-auto] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_index_write[3] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region[3] - Attr... 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_append_chunk_partial[3] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_chunk_partial_offset[3] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_append_dim[3] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-r+] 1551s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-a] 1551s FAILED tests/test_backends.py::TestScipyFilePath::test_roundtrip_example_1_netcdf_gz 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_zero_dimensional_variable 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_test_data 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_load - ModuleNotFo... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dataset_compute - ... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_pickle - ModuleNot... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_pickle_dataarray 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dataset_caching - ... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_None_variable 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_object_dtype 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_string_data 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_string_encoded_characters 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_numpy_datetime_data 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_cftime_datetime_data 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_timedelta_data 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_float64_data 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_coordinates 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_global_coordinates 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_coordinates_with_space 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_boolean_dtype 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_orthogonal_indexing 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_vectorized_indexing 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_vectorized_indexing_negative_step 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_outer_indexing_reversed 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_isel_dataarray - M... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_array_type_after_indexing 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dropna - ModuleNot... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_ondisk_after_print 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_bytes_with_fill_value 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_empty_vlen_string_array 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[fill_value0-False] 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[fill_value1-True] 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[-1-False] 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[255-True] 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_grid_mapping_and_bounds_are_not_coordinates_in_file 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_coordinate_variables_after_dataset_roundtrip 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_coordinates_encoding 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg - M... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg_dates 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg_fixed_width_string 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_default_fill_value 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_via_encoding_kwarg 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_in_coord 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_same_dtype 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_append_write - Mod... 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_append_overwrite_values 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_multiindex_not_implemented 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_string_object_warning 1551s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_unlimited_dims 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-all-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-different-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-all-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-different-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-different-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-all-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-all-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-minimal-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-minimal-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-different-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-different-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-all-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-all-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-minimal-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-minimal-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-different-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-different-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[drop] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[override] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[no_conflicts] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[identical] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[drop_conflicts] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_attr_by_coords 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataarray_attr_by_coords 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[all-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[all-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[minimal-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[minimal-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[different-nested-t] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[different-by_coords-None] 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_common_coord_when_datavars_all 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_common_coord_when_datavars_minimal 1551s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_invalid_data_vars_value_should_fail 1551s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_no_name 1551s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_with_name 1551s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_coord_name_clash 1551s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_open_dataarray_options 1551s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_no_name_pathlib 1551s FAILED tests/test_backends.py::test_source_encoding_always_present - ModuleNo... 1551s FAILED tests/test_backends.py::test_source_encoding_always_present_with_pathlib 1551s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[proleptic_gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[standard] 1551s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_out_of_range[standard] 1551s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_out_of_range[gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-360_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-365_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-366_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-all_leap] - ModuleNo... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-gregorian] - ModuleN... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-julian] - ModuleNotF... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-noleap] - ModuleNotF... 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-proleptic_gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_true[1500-standard] - ModuleNo... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-360_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-365_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-366_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-all_leap] - ModuleNo... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-gregorian] - ModuleN... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-julian] - ModuleNotF... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-noleap] - ModuleNotF... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-proleptic_gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_true[2000-standard] - ModuleNo... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-360_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-365_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-366_day] - ModuleNot... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-all_leap] - ModuleNo... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-gregorian] - ModuleN... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-julian] - ModuleNotF... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-noleap] - ModuleNotF... 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-proleptic_gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_true[2500-standard] - ModuleNo... 1551s FAILED tests/test_backends.py::test_use_cftime_false_standard_calendar_out_of_range[standard] 1551s FAILED tests/test_backends.py::test_use_cftime_false_standard_calendar_out_of_range[gregorian] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-360_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-365_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-366_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-all_leap] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-julian] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-noleap] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-360_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-365_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-366_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-all_leap] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-julian] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-noleap] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-360_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-365_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-366_day] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-all_leap] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-julian] 1551s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-noleap] 1551s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[auto] - Attrib... 1551s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[-1] - Attribut... 1551s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks2] - Att... 1551s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks3] - Att... 1551s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks4] - Att... 1551s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks5] - Att... 1551s FAILED tests/test_backends.py::test_chunking_consintency[auto] - AttributeErr... 1551s FAILED tests/test_backends.py::test_chunking_consintency[-1] - AttributeError... 1551s FAILED tests/test_backends.py::test_chunking_consintency[chunks2] - Attribute... 1551s FAILED tests/test_backends.py::test_chunking_consintency[chunks3] - Attribute... 1551s FAILED tests/test_backends.py::test_chunking_consintency[chunks4] - Attribute... 1551s FAILED tests/test_backends.py::test_chunking_consintency[chunks5] - Attribute... 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_not_consolidated[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_round_trip[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_chunks[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups[zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[True-zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[False-zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[None-zarr_format=3] 1551s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_chunks[zarr_format=3] 1551s FAILED tests/test_dask.py::test_normalize_token_with_backend - ModuleNotFound... 1551s FAILED tests/test_plugins.py::test_list_engines - AssertionError: assert ('h5... 1551s = 514 failed, 18336 passed, 2690 skipped, 62 deselected, 234 xfailed, 56 xpassed, 959 warnings in 1177.40s (0:19:37) = 1556s E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build; python3.14 -m pytest --deselect=tests/test_cftimeindex.py::test_asi8 --deselect=tests/test_datatree.py::TestRepr::test_doc_example --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 --deselect=tests/test_strategies.py::TestReduction::test_mean 1556s I: pybuild base:311: cd /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build; python3.13 -m pytest --deselect=tests/test_cftimeindex.py::test_asi8 --deselect=tests/test_datatree.py::TestRepr::test_doc_example --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 --deselect=tests/test_strategies.py::TestReduction::test_mean 1568s ============================= test session starts ============================== 1568s platform linux -- Python 3.13.9, pytest-8.3.5, pluggy-1.6.0 1568s rootdir: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build 1568s configfile: pyproject.toml 1568s plugins: typeguard-4.4.2, hypothesis-6.130.5, mypy-plugins-3.2.0, xdist-3.8.0, zarr-3.1.3 1568s collected 21888 items / 62 deselected / 4 skipped / 21826 selected 1568s 1568s tests/test_accessor_dt.py .............................................. [ 0%] 1569s ........................................................................ [ 0%] 1570s ........................................................................ [ 0%] 1572s ........................................................................ [ 1%] 1573s ........................................................................ [ 1%] 1573s .................... [ 1%] 1573s tests/test_accessor_str.py ............................................. [ 1%] 1574s ........................................................................ [ 2%] 1574s ........................................................................ [ 2%] 1574s ...................................... [ 2%] 1574s tests/test_assertions.py .............................. [ 2%] 1577s tests/test_backends.py .................s...............XxXxXXxXxX...... [ 3%] 1578s .s.s....................................................s............... [ 3%] 1582s ....s..............XxXxXXxXxX.......s.s................................. [ 3%] 1586s ..................s..s...................s...............XxXsXsssss..... [ 4%] 1592s ..s..................Fs........s.s.................ss................... [ 4%] 1600s ..........................................................s............. [ 4%] 1609s ..XxXsXsssss.......s..................Fs........s.s.................ss.. [ 5%] 1620s ........................................................................ [ 5%] 1631s ...s...............XxXsXsssss.......s..................Fs........s.s.... [ 5%] 1642s .............ss......................................................... [ 5%] 1656s .....FFF......................FFFFF...F.....Fs....FFFFFFFFF..xxxsxsssssF [ 6%] 1676s FFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ssFFFFFFFFFFFFFFFFF [ 6%] 1697s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF...F.....Fs....FFFFF [ 6%] 1717s FFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ss [ 7%] 1742s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF... [ 7%] 1762s F.....Fs....FFFFFFFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss. [ 7%] 1784s FFFF...F....F..ssFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.F [ 8%] 1797s F.FFF...FFFFFFFFFF....FF.F.F.FFFFFs..................s...............XxX [ 8%] 1800s sXXxXsX.......s.s................................s...............XxXsXXx [ 8%] 1802s XsX.......s.s...............ss.................s...............XxXsXXxXs [ 9%] 1804s X.......s.s....................................s...............XxXsXXxXs [ 9%] 1806s X.......s.s.................................s...............XxXsXXxXsX.. [ 9%] 1809s .....s.s...............................s...............XxXsXXxXsX....... [ 10%] 1814s s.s...................................s...............XxXsXXxXsX.......s [ 10%] 1817s .s.............................................sss...................... [ 10%] 1822s .......s...............XxXsXXxXsX.......s.s............................. [ 11%] 1829s ................sss.............................s...............XxXsXXxX [ 11%] 1832s sX.......s.s.............................................sss...........s [ 11%] 1833s ..ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.... [ 12%] 1836s .................................................s..................s... [ 12%] 1838s ..........................sssssss..x........s..s..s..s.sss.............. [ 12%] 1843s ......................XXX........................s.FFFFFFFFFFFF......Fss [ 13%] 1844s . [ 13%] 1844s tests/test_backends_api.py ........................ [ 13%] 1844s tests/test_backends_common.py ... [ 13%] 1849s tests/test_backends_datatree.py ..................F.FFF.F.......F.F.F.F. [ 13%] 1851s F.F.F.F...... [ 13%] 1853s tests/test_backends_file_manager.py ............................... [ 13%] 1853s tests/test_backends_locks.py . [ 13%] 1853s tests/test_backends_lru_cache.py ........ [ 13%] 1857s tests/test_calendar_ops.py ........................... [ 13%] 1857s tests/test_cftime_offsets.py ........................................... [ 14%] 1857s ........................................................................ [ 14%] 1857s ........................................................................ [ 14%] 1857s ........................................................................ [ 15%] 1857s ........................................................................ [ 15%] 1857s ........................................................................ [ 15%] 1857s ........................................................................ [ 16%] 1857s ........................................................................ [ 16%] 1857s ........................................................................ [ 16%] 1857s ........................................................................ [ 17%] 1857s ........................................................................ [ 17%] 1857s ........................................................................ [ 17%] 1857s ........................................................................ [ 18%] 1858s ........................................................................ [ 18%] 1858s ........................................................................ [ 18%] 1858s ........................................................................ [ 19%] 1858s ........................................................................ [ 19%] 1858s ........................................................................ [ 19%] 1858s ........................................................................ [ 20%] 1858s ........................................................................ [ 20%] 1858s ........................................................................ [ 20%] 1858s ........................................................................ [ 21%] 1858s ........................................................................ [ 21%] 1858s ........................................................................ [ 21%] 1858s ........................................................................ [ 22%] 1859s ........................................................................ [ 22%] 1859s ........................................................................ [ 22%] 1859s ........................................................................ [ 23%] 1859s ........................................................................ [ 23%] 1859s ........................................................................ [ 23%] 1859s ........................................................................ [ 24%] 1859s ........................................................................ [ 24%] 1859s ........................................................................ [ 24%] 1859s ........................................................................ [ 25%] 1859s ........................................................................ [ 25%] 1859s ........................................................................ [ 25%] 1860s ........................................................................ [ 26%] 1860s ........................................................................ [ 26%] 1860s ........................................................................ [ 26%] 1860s .............ssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 26%] 1860s .ssss....ssss....ssss....ssss.................................. [ 27%] 1860s tests/test_cftimeindex.py .............................................. [ 27%] 1860s ........................................................................ [ 27%] 1860s ........................................................................ [ 28%] 1860s ........................................................................ [ 28%] 1860s ........................................................................ [ 28%] 1861s ........................................................................ [ 29%] 1861s ........................................................................ [ 29%] 1861s ........................................................................ [ 29%] 1861s ........................................................................ [ 30%] 1861s ........................................................................ [ 30%] 1862s ........................................................................ [ 30%] 1862s ........................................................................ [ 31%] 1862s ...........................................x............................ [ 31%] 1862s ........................................................................ [ 31%] 1862s ....................................... [ 31%] 1863s tests/test_cftimeindex_resample.py ..................................... [ 32%] 1864s ........................................................................ [ 32%] 1865s ........................................................................ [ 32%] 1865s ........................................................................ [ 33%] 1866s ........................................................................ [ 33%] 1867s ........................................................................ [ 33%] 1868s ........................................................................ [ 34%] 1868s ................................................ [ 34%] 1869s tests/test_coarsen.py .................................................. [ 34%] 1870s ........................................................................ [ 34%] 1871s ..........s.......s.......s.......s.......s.......s.......s.......s..... [ 35%] 1871s .... [ 35%] 1871s tests/test_coding.py ............................... [ 35%] 1871s tests/test_coding_strings.py ....................... [ 35%] 1871s tests/test_coding_times.py ............................................. [ 35%] 1871s ........................................................................ [ 36%] 1871s ........................................................................ [ 36%] 1872s ........................................................................ [ 36%] 1872s ........................................................................ [ 37%] 1872s ........................................................................ [ 37%] 1872s ........................................................................ [ 37%] 1873s ........................................................................ [ 37%] 1873s ........................................................................ [ 38%] 1873s ........................................................................ [ 38%] 1874s ...................s..................................................XX [ 38%] 1874s X....................................................................... [ 39%] 1874s ........................................................................ [ 39%] 1874s ......................................ssssssss......s......s......s..... [ 39%] 1876s .s......s............................................................... [ 40%] 1876s .......................................................... [ 40%] 1877s tests/test_combine.py .......................................x.......... [ 40%] 1877s ...................................................... [ 41%] 1877s tests/test_computation.py .............................................. [ 41%] 1879s ........................................................................ [ 41%] 1882s ........................................................................ [ 41%] 1885s ........................................................................ [ 42%] 1886s ..................................XxXx. [ 42%] 1887s tests/test_concat.py ................................................... [ 42%] 1887s ................................................. [ 42%] 1887s tests/test_conventions.py .............................................. [ 43%] 1889s ...s..............XxXsXXxXsX.......s.s............s........... [ 43%] 1889s tests/test_coordinate_transform.py ............ [ 43%] 1889s tests/test_coordinates.py ...................... [ 43%] 1891s tests/test_dask.py ..................................................... [ 43%] 1911s ..........XXx.X......................................................... [ 44%] 1913s ........................................................................ [ 44%] 1914s ...................... [ 44%] 1914s tests/test_dataarray.py ................................................ [ 44%] 1915s ........................................................................ [ 45%] 1915s ........................................................................ [ 45%] 1916s ........................................................................ [ 45%] 1918s s...ss......................................Xx.......................... [ 46%] 1919s ..........................ss....ss...................................... [ 46%] 1923s ............x.....................................x.......x............. [ 46%] 1923s ................sssssssssssss.................ss...... [ 46%] 1982s tests/test_dataarray_typing.yml .............. [ 47%] 1985s tests/test_dataset.py .................................................. [ 47%] 1986s ........................................................................ [ 47%] 1986s ......Xx...................................................s............ [ 47%] 1987s ..............................................s......................... [ 48%] 1987s ........................................................................ [ 48%] 1989s ...............................................................ss....ss. [ 48%] 1991s ......................................................................ss [ 49%] 1991s ... [ 49%] 2045s tests/test_dataset_typing.yml .............. [ 49%] 2046s tests/test_datatree.py ............................xx..........x......x. [ 49%] 2046s ........................................................................ [ 49%] 2046s .......x.......... [ 49%] 2046s tests/test_datatree_mapping.py .............x........ [ 50%] 2099s tests/test_datatree_typing.yml .............. [ 50%] 2099s tests/test_deprecation_helpers.py .. [ 50%] 2099s tests/test_dtypes.py ................................................... [ 50%] 2099s ...sss... [ 50%] 2099s tests/test_duck_array_ops.py ......s...........s.................XX..... [ 50%] 2100s ................XX.....................XX.....................XX..s..... [ 50%] 2101s ..................................ss..............ss..............ss.... [ 51%] 2103s ..ss......ss..............ss............................................ [ 51%] 2104s ..........ss......ss..............................ss..............ss.... [ 51%] 2107s ..........ss......ss......ss..............ss............................ [ 52%] 2109s ..........................ss......ss................ssssssssss.......... [ 52%] 2109s ssssssssss..........ssssssssss..........ssssssssss..........ssssss...... [ 52%] 2110s ........ssssss..............ssssss..............ssssss..............ssss [ 53%] 2111s sssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s. [ 53%] 2111s 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%] 2113s s.s.s.s.s.s............................................................. [ 54%] 2114s ........................................................................ [ 54%] 2115s ........................................................................ [ 54%] 2116s ........................................................................ [ 55%] 2117s ........................................................................ [ 55%] 2118s ........................................................................ [ 55%] 2123s ........................................................ [ 56%] 2123s tests/test_duck_array_wrapping.py s.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.sxss.s [ 56%] 2124s .ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.s.ssXsxss.sxss.sxss.sxss.s.ss.s.s [ 56%] 2125s sxsxssxsxssxsxss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.sxssxsxss.s.ss.s.ss. [ 56%] 2125s sxss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ssXsxss.s.ss.sxss.sx [ 57%] 2126s ss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss [ 57%] 2126s .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%] 2126s 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%] 2126s s.s.ss.s.ss.s.ss.s.s [ 58%] 2126s tests/test_error_messages.py .. [ 58%] 2126s tests/test_extensions.py .... [ 58%] 2127s tests/test_formatting.py ............................................... [ 58%] 2127s ..... [ 58%] 2127s tests/test_formatting_html.py ........................ [ 58%] 2129s tests/test_groupby.py ......................s........................... [ 59%] 2130s ...............................ss....................................... [ 59%] 2132s ........................................................................ [ 59%] 2133s .............................................................sssssssss.. [ 59%] 2135s ..s..............sssssssssss............. [ 60%] 2135s tests/test_hashable.py ........ [ 60%] 2135s tests/test_indexes.py .................................................. [ 60%] 2135s ........................ [ 60%] 2135s tests/test_indexing.py ................................................. [ 60%] 2136s ........................................................................ [ 61%] 2136s ............... [ 61%] 2147s tests/test_interp.py ................................................... [ 61%] 2156s .x...................................................................... [ 61%] 2176s ................................................................sss..sss [ 62%] 2207s ..sss..sss..sss..sss..sss..sss............... [ 62%] 2207s tests/test_merge.py .................................................... [ 62%] 2207s ... [ 62%] 2211s tests/test_missing.py .................................................. [ 62%] 2212s ..................s...........................................x.. [ 63%] 2212s tests/test_namedarray.py ....x...........................s.............. [ 63%] 2212s .. [ 63%] 2212s tests/test_nputils.py .. [ 63%] 2212s tests/test_options.py ................... [ 63%] 2213s tests/test_pandas_to_xarray.py xxxxxxxxxxxxxxxxxxxxxxxsxxxxxx........... [ 63%] 2213s ....................... [ 63%] 2213s tests/test_parallelcompat.py ............... [ 63%] 2214s tests/test_plot.py ..................................................... [ 63%] 2216s ........................................................................ [ 64%] 2222s ........................................................................ [ 64%] 2227s ...............................................s........................ [ 64%] 2233s .............X.......................................................x.. [ 65%] 2256s ss.ssss................................................................. [ 65%] 2258s .......sss.............................................................. [ 65%] 2259s .......................................... [ 66%] 2259s tests/test_plugins.py ............. [ 66%] 2260s tests/test_print_versions.py . [ 66%] 2265s tests/test_rolling.py .................................................. [ 66%] 2268s ........................................................................ [ 66%] 2272s ........................................................................ [ 67%] 2273s ........................................................................ [ 67%] 2277s ........................................................................ [ 67%] 2282s ........................................................................ [ 68%] 2282s ........................................................................ [ 68%] 2283s ........................................................................ [ 68%] 2284s ........................................................................ [ 69%] 2284s ........................................................................ [ 69%] 2287s ........................................................................ [ 69%] 2293s ........................................................................ [ 70%] 2297s ........................................................................ [ 70%] 2302s ........................................................................ [ 70%] 2303s ........................................................................ [ 71%] 2303s ........................................................................ [ 71%] 2304s ........................................................................ [ 71%] 2305s ........................................................................ [ 72%] 2309s ........................................................................ [ 72%] 2313s ........................................................................ [ 72%] 2317s ........................................................................ [ 73%] 2318s ........................................................................ [ 73%] 2319s ........................................................................ [ 73%] 2319s ........................................................................ [ 74%] 2321s ........................................................................ [ 74%] 2327s ........................................................................ [ 74%] 2331s ........................................................................ [ 75%] 2335s ........................................................................ [ 75%] 2337s ........................................................................ [ 75%] 2338s ........................................................................ [ 76%] 2338s ........................................................................ [ 76%] 2346s ........................................................................ [ 76%] 2349s ...........ssssssssssssssssssssssssssssssssssssssssss................... [ 77%] 2350s ........................................................................ [ 77%] 2350s ........................................................................ [ 77%] 2351s ........................................................................ [ 77%] 2352s ........................................................................ [ 78%] 2353s ........................................................................ [ 78%] 2353s ........................................................ssssssssssssssss [ 78%] 2354s ........................................................................ [ 79%] 2355s ........................................................................ [ 79%] 2355s ........................................................................ [ 79%] 2356s ........................................................................ [ 80%] 2361s ........................................................................ [ 80%] 2367s ........................................................................ [ 80%] 2372s ssssssssssssssss........................................................ [ 81%] 2380s ........................................................................ [ 81%] 2386s ........................................................................ [ 81%] 2392s ........................................................................ [ 82%] 2400s ........................................................................ [ 82%] 2400s ........sss [ 82%] 2413s tests/test_strategies.py .................... [ 82%] 2413s tests/test_treenode.py .................................. [ 82%] 2416s tests/test_tutorial.py XXss [ 82%] 2416s tests/test_typed_ops.py ..... [ 82%] 2416s tests/test_ufuncs.py ................................................... [ 83%] 2417s .......................................................................x [ 83%] 2417s .. [ 83%] 2418s tests/test_units.py .s..s..s..s......sssssxxxxx.....sssss.xxxx.....sssss [ 83%] 2421s xxxxx.....sssss.xxxx.....sssssxxxxx.....sssss.xxxx.....sssssxxxxx.....ss [ 84%] 2423s sss.xxxx.........sssss..........sssss..........sssss..........sssss..... [ 84%] 2423s .....sssss..........sssss..........sssss..........sssss..........sssss.. [ 84%] 2424s ........sssss..........sssss..........sssss......s..s..s..s..s..s..s..s. [ 85%] 2425s .sx.sx.sx.sx............................................................ [ 85%] 2425s ........................................................................ [ 85%] 2425s ...................ssssssssss..........ssssssssss....................... [ 86%] 2425s ........................................................................ [ 86%] 2426s ...................................ss..XX............ss..XX............. [ 86%] 2426s ........................................................................ [ 87%] 2426s .....................s..s..ss....ss......ss..s.......................ss. [ 87%] 2426s .s...................................................................... [ 87%] 2434s ....x....x......................xxxxx.....xxxxx.x.x.x.x.x.x.x.x.x.x..... [ 88%] 2436s .xxxx................................................................... [ 88%] 2437s ...............x...............sssss.....sssssssssssssss.....sssss.....s [ 88%] 2437s ssssssssssssss.....sssss..........sssss..................s..s..s..s.ssss [ 89%] 2437s ss.s..s..s..s..s..s..s..s.ssssss.s..s..s..s...........ssssssssssssssssss [ 89%] 2437s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 89%] 2440s ........................................................xx..xx..ssssssss [ 90%] 2443s ssssssssssssxx..xx..ssssssssssssssssssss......ss....s......s..s.s.s.s.s. [ 90%] 2444s s...ss....ss....ss....ss....ss....ss....ss....ss...s..s..s.xs.sss.s..s.. [ 90%] 2445s s..s.xs.sss.s.....ss....ss....ss....ss....ss....ss....ss....ss.......sss [ 91%] 2445s ss..........sssss.......ss....ss........................................ [ 91%] 2447s ....................xxxx................................................ [ 91%] 2448s ..................................xx.....sssss.....sssss.....sssss.....s [ 92%] 2448s ssssssssssssss.....sssss.....sssssssssssssss.....sssss.....sssss........ [ 92%] 2449s .......sss...sssxx....s......s......ssssssssssssssssssssssssssssssssssss [ 92%] 2449s ssssssssssssssssssssssssssssssssssssssssssssssssssssss...sss......sss... [ 92%] 2452s ..................................................xx..xx..ssssssssssssss [ 93%] 2455s ssssssxx..xx..ssssssssssssssssssss............ssssssssssss.............. [ 93%] 2457s ..........ssssssssssss...............xx.ssssss...Xx....xx.ssssss...Xx..s [ 93%] 2458s ..s...........ssssssssss....................ssssssssss.................. [ 94%] 2458s s.....ssssssssssssss........s.............s.....ssssssssssssss........s. [ 94%] 2460s .........sssss..........sssss.......x.x.x.... [ 94%] 2460s tests/test_utils.py .................................................... [ 95%] 2460s .............. [ 95%] 2460s tests/test_variable.py ................................................. [ 95%] 2460s ........................................................................ [ 95%] 2460s ........................................................................ [ 96%] 2461s ........................................................................ [ 96%] 2462s ........................................................................ [ 96%] 2473s .................ssss...............x.xX.......xX.......xx.......xx..... [ 97%] 2474s ..xx.......s............................................................ [ 97%] 2474s ........................ssssssssssssssssssssssssssssssssssssssssssssssss [ 97%] 2474s sssssss..........................ssss....................... [ 97%] 2475s tests/test_weighted.py ................................................. [ 98%] 2475s ........................................................ssssssssssssssss [ 98%] 2475s ssssssssssssssssssssssssssssssssssssssssssssssssssssssss................ [ 98%] 2478s ........................................................................ [ 99%] 2480s ........................................................................ [ 99%] 2483s ........................................................................ [ 99%] 2485s ................................... [100%] 2485s 2485s =================================== FAILURES =================================== 2485s _________________ TestZarrDictStore.test_non_existent_store[2] _________________ 2485s 2485s self = 2485s 2485s def test_non_existent_store(self) -> None: 2485s with pytest.raises( 2485s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2485s ): 2485s > xr.open_zarr(f"{uuid.uuid4()}") 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2485s ds = open_dataset( 2485s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2485s backend_ds = backend.open_dataset( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 2485s store = ZarrStore.open_group( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 2485s ) = _get_open_params( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 2485s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 2485s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 2485s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 2485s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2485s raise return_result 2485s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2485s return await coro 2485s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 2485s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 2485s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2485s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 2485s store = await make_store(store_like, mode=mode, storage_options=storage_options) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 2485s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 2485s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 2485s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 2485s await store._open() 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s 2485s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/57fd3829-e66c-4551-bf87-654bcabc3080') 2485s 2485s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 2485s if not self.read_only: 2485s self.root.mkdir(parents=True, exist_ok=True) 2485s 2485s if not self.root.exists(): 2485s > raise FileNotFoundError(f"{self.root} does not exist") 2485s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/57fd3829-e66c-4551-bf87-654bcabc3080 does not exist 2485s 2485s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 2485s 2485s During handling of the above exception, another exception occurred: 2485s 2485s self = 2485s 2485s def test_non_existent_store(self) -> None: 2485s > with pytest.raises( 2485s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2485s ): 2485s E AssertionError: Regex pattern did not match. 2485s E Regex: '(No such file or directory|Unable to find group)' 2485s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/57fd3829-e66c-4551-bf87-654bcabc3080 does not exist' 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 2485s ______________ TestZarrDirectoryStore.test_non_existent_store[2] _______________ 2485s 2485s self = 2485s 2485s def test_non_existent_store(self) -> None: 2485s with pytest.raises( 2485s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2485s ): 2485s > xr.open_zarr(f"{uuid.uuid4()}") 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2485s ds = open_dataset( 2485s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2485s backend_ds = backend.open_dataset( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 2485s store = ZarrStore.open_group( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 2485s ) = _get_open_params( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 2485s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 2485s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 2485s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 2485s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2485s raise return_result 2485s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2485s return await coro 2485s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 2485s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 2485s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2485s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 2485s store = await make_store(store_like, mode=mode, storage_options=storage_options) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 2485s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 2485s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 2485s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 2485s await store._open() 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s 2485s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/94f30200-9145-4e82-9e8a-e80b67ed21d3') 2485s 2485s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 2485s if not self.read_only: 2485s self.root.mkdir(parents=True, exist_ok=True) 2485s 2485s if not self.root.exists(): 2485s > raise FileNotFoundError(f"{self.root} does not exist") 2485s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/94f30200-9145-4e82-9e8a-e80b67ed21d3 does not exist 2485s 2485s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 2485s 2485s During handling of the above exception, another exception occurred: 2485s 2485s self = 2485s 2485s def test_non_existent_store(self) -> None: 2485s > with pytest.raises( 2485s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2485s ): 2485s E AssertionError: Regex pattern did not match. 2485s E Regex: '(No such file or directory|Unable to find group)' 2485s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/94f30200-9145-4e82-9e8a-e80b67ed21d3 does not exist' 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 2485s ________________ TestZarrWriteEmpty.test_non_existent_store[2] _________________ 2485s 2485s self = 2485s 2485s def test_non_existent_store(self) -> None: 2485s with pytest.raises( 2485s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2485s ): 2485s > xr.open_zarr(f"{uuid.uuid4()}") 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2485s ds = open_dataset( 2485s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2485s backend_ds = backend.open_dataset( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 2485s store = ZarrStore.open_group( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 2485s ) = _get_open_params( 2485s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 2485s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 2485s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 2485s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 2485s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2485s raise return_result 2485s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2485s return await coro 2485s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 2485s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 2485s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2485s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 2485s store = await make_store(store_like, mode=mode, storage_options=storage_options) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 2485s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 2485s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 2485s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 2485s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 2485s await store._open() 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s 2485s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/94536e4c-c469-40fb-8741-14e9e0f24c4f') 2485s 2485s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 2485s if not self.read_only: 2485s self.root.mkdir(parents=True, exist_ok=True) 2485s 2485s if not self.root.exists(): 2485s > raise FileNotFoundError(f"{self.root} does not exist") 2485s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/94536e4c-c469-40fb-8741-14e9e0f24c4f does not exist 2485s 2485s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 2485s 2485s During handling of the above exception, another exception occurred: 2485s 2485s self = 2485s 2485s def test_non_existent_store(self) -> None: 2485s > with pytest.raises( 2485s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2485s ): 2485s E AssertionError: Regex pattern did not match. 2485s E Regex: '(No such file or directory|Unable to find group)' 2485s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/94536e4c-c469-40fb-8741-14e9e0f24c4f does not exist' 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 2485s _______________ TestZarrWriteEmpty.test_write_empty[2-True-True] _______________ 2485s 2485s self = 2485s consolidated = True, write_empty = True 2485s 2485s @pytest.mark.parametrize("consolidated", [True, False, None]) 2485s @pytest.mark.parametrize("write_empty", [True, False, None]) 2485s def test_write_empty( 2485s self, 2485s consolidated: bool | None, 2485s write_empty: bool | None, 2485s ) -> None: 2485s def assert_expected_files(expected: list[str], store: str) -> None: 2485s """Convenience for comparing with actual files written""" 2485s ls = [] 2485s test_root = os.path.join(store, "test") 2485s for root, _, files in os.walk(test_root): 2485s ls.extend( 2485s [ 2485s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2485s for f in files 2485s ] 2485s ) 2485s 2485s assert set(expected) == set( 2485s [ 2485s file.lstrip("c/") 2485s for file in ls 2485s if (file not in (".zattrs", ".zarray", "zarr.json")) 2485s ] 2485s ) 2485s 2485s # The zarr format is set by the `default_zarr_format` 2485s # pytest fixture that acts on a superclass 2485s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2485s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2485s expected = ["0.1.0"] 2485s else: 2485s expected = [ 2485s "0.0.0", 2485s "0.0.1", 2485s "0.1.0", 2485s "0.1.1", 2485s ] 2485s 2485s if zarr_format_3: 2485s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2485s # transform to the path style of zarr 3 2485s # e.g. 0/0/1 2485s expected = [e.replace(".", "/") for e in expected] 2485s else: 2485s # use nan for default fill_value behaviour 2485s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2485s 2485s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2485s 2485s if has_dask: 2485s ds["test"] = ds["test"].chunk(1) 2485s encoding = None 2485s else: 2485s encoding = {"test": {"chunks": (1, 1, 1)}} 2485s 2485s with self.temp_dir() as (d, store): 2485s ds.to_zarr( 2485s store, 2485s mode="w", 2485s encoding=encoding, 2485s write_empty_chunks=write_empty, 2485s ) 2485s 2485s # check expected files after a write 2485s assert_expected_files(expected, store) 2485s 2485s with self.roundtrip_dir( 2485s ds, 2485s store, 2485s save_kwargs={ 2485s "mode": "a", 2485s "append_dim": "Z", 2485s "write_empty_chunks": write_empty, 2485s }, 2485s ) as a_ds: 2485s expected_ds = xr.concat([ds, ds], dim="Z") 2485s 2485s assert_identical(a_ds, expected_ds.compute()) 2485s # add the new files we expect to be created by the append 2485s # that was performed by the roundtrip_dir 2485s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2485s expected.append("1.1.0") 2485s else: 2485s if not has_zarr_v3: 2485s # TODO: remove zarr3 if once zarr issue is fixed 2485s # https://github.com/zarr-developers/zarr-python/issues/2931 2485s expected.extend( 2485s [ 2485s "1.1.0", 2485s "1.0.0", 2485s "1.0.1", 2485s "1.1.1", 2485s ] 2485s ) 2485s else: 2485s expected.append("1.1.0") 2485s if zarr_format_3: 2485s expected = [e.replace(".", "/") for e in expected] 2485s > assert_expected_files(expected, store) 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s 2485s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 2485s store = '/tmp/tmplerzbawr/test.zarr' 2485s 2485s def assert_expected_files(expected: list[str], store: str) -> None: 2485s """Convenience for comparing with actual files written""" 2485s ls = [] 2485s test_root = os.path.join(store, "test") 2485s for root, _, files in os.walk(test_root): 2485s ls.extend( 2485s [ 2485s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2485s for f in files 2485s ] 2485s ) 2485s 2485s > assert set(expected) == set( 2485s [ 2485s file.lstrip("c/") 2485s for file in ls 2485s if (file not in (".zattrs", ".zarray", "zarr.json")) 2485s ] 2485s ) 2485s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 2485s E 2485s E Extra items in the right set: 2485s E '1.0.0' 2485s E '1.0.1' 2485s E '1.1.1' 2485s E Use -v to get more diff 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 2485s ______________ TestZarrWriteEmpty.test_write_empty[2-True-False] _______________ 2485s 2485s self = 2485s consolidated = False, write_empty = True 2485s 2485s @pytest.mark.parametrize("consolidated", [True, False, None]) 2485s @pytest.mark.parametrize("write_empty", [True, False, None]) 2485s def test_write_empty( 2485s self, 2485s consolidated: bool | None, 2485s write_empty: bool | None, 2485s ) -> None: 2485s def assert_expected_files(expected: list[str], store: str) -> None: 2485s """Convenience for comparing with actual files written""" 2485s ls = [] 2485s test_root = os.path.join(store, "test") 2485s for root, _, files in os.walk(test_root): 2485s ls.extend( 2485s [ 2485s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2485s for f in files 2485s ] 2485s ) 2485s 2485s assert set(expected) == set( 2485s [ 2485s file.lstrip("c/") 2485s for file in ls 2485s if (file not in (".zattrs", ".zarray", "zarr.json")) 2485s ] 2485s ) 2485s 2485s # The zarr format is set by the `default_zarr_format` 2485s # pytest fixture that acts on a superclass 2485s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2485s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2485s expected = ["0.1.0"] 2485s else: 2485s expected = [ 2485s "0.0.0", 2485s "0.0.1", 2485s "0.1.0", 2485s "0.1.1", 2485s ] 2485s 2485s if zarr_format_3: 2485s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2485s # transform to the path style of zarr 3 2485s # e.g. 0/0/1 2485s expected = [e.replace(".", "/") for e in expected] 2485s else: 2485s # use nan for default fill_value behaviour 2485s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2485s 2485s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2485s 2485s if has_dask: 2485s ds["test"] = ds["test"].chunk(1) 2485s encoding = None 2485s else: 2485s encoding = {"test": {"chunks": (1, 1, 1)}} 2485s 2485s with self.temp_dir() as (d, store): 2485s ds.to_zarr( 2485s store, 2485s mode="w", 2485s encoding=encoding, 2485s write_empty_chunks=write_empty, 2485s ) 2485s 2485s # check expected files after a write 2485s assert_expected_files(expected, store) 2485s 2485s with self.roundtrip_dir( 2485s ds, 2485s store, 2485s save_kwargs={ 2485s "mode": "a", 2485s "append_dim": "Z", 2485s "write_empty_chunks": write_empty, 2485s }, 2485s ) as a_ds: 2485s expected_ds = xr.concat([ds, ds], dim="Z") 2485s 2485s assert_identical(a_ds, expected_ds.compute()) 2485s # add the new files we expect to be created by the append 2485s # that was performed by the roundtrip_dir 2485s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2485s expected.append("1.1.0") 2485s else: 2485s if not has_zarr_v3: 2485s # TODO: remove zarr3 if once zarr issue is fixed 2485s # https://github.com/zarr-developers/zarr-python/issues/2931 2485s expected.extend( 2485s [ 2485s "1.1.0", 2485s "1.0.0", 2485s "1.0.1", 2485s "1.1.1", 2485s ] 2485s ) 2485s else: 2485s expected.append("1.1.0") 2485s if zarr_format_3: 2485s expected = [e.replace(".", "/") for e in expected] 2485s > assert_expected_files(expected, store) 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 2485s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2485s 2485s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 2485s store = '/tmp/tmpulqcdpeb/test.zarr' 2485s 2485s def assert_expected_files(expected: list[str], store: str) -> None: 2485s """Convenience for comparing with actual files written""" 2485s ls = [] 2485s test_root = os.path.join(store, "test") 2485s for root, _, files in os.walk(test_root): 2485s ls.extend( 2485s [ 2485s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2485s for f in files 2485s ] 2485s ) 2485s 2485s > assert set(expected) == set( 2485s [ 2485s file.lstrip("c/") 2485s for file in ls 2485s if (file not in (".zattrs", ".zarray", "zarr.json")) 2485s ] 2485s ) 2485s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 2485s E 2485s E Extra items in the right set: 2485s E '1.0.0' 2485s E '1.0.1' 2485s E '1.1.1' 2485s E Use -v to get more diff 2485s 2485s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 2485s _______________ TestZarrWriteEmpty.test_write_empty[2-True-None] _______________ 2485s 2485s self = 2485s consolidated = None, write_empty = True 2485s 2485s @pytest.mark.parametrize("consolidated", [True, False, None]) 2485s @pytest.mark.parametrize("write_empty", [True, False, None]) 2485s def test_write_empty( 2485s self, 2485s consolidated: bool | None, 2485s write_empty: bool | None, 2485s ) -> None: 2485s def assert_expected_files(expected: list[str], store: str) -> None: 2485s """Convenience for comparing with actual files written""" 2485s ls = [] 2485s test_root = os.path.join(store, "test") 2485s for root, _, files in os.walk(test_root): 2485s ls.extend( 2485s [ 2485s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2485s for f in files 2485s ] 2485s ) 2485s 2485s assert set(expected) == set( 2485s [ 2485s file.lstrip("c/") 2485s for file in ls 2485s if (file not in (".zattrs", ".zarray", "zarr.json")) 2485s ] 2485s ) 2485s 2485s # The zarr format is set by the `default_zarr_format` 2485s # pytest fixture that acts on a superclass 2485s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2485s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2485s expected = ["0.1.0"] 2485s else: 2485s expected = [ 2485s "0.0.0", 2485s "0.0.1", 2485s "0.1.0", 2485s "0.1.1", 2485s ] 2485s 2485s if zarr_format_3: 2485s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2485s # transform to the path style of zarr 3 2485s # e.g. 0/0/1 2485s expected = [e.replace(".", "/") for e in expected] 2485s else: 2485s # use nan for default fill_value behaviour 2485s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2485s 2485s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2485s 2485s if has_dask: 2485s ds["test"] = ds["test"].chunk(1) 2485s encoding = None 2485s else: 2485s encoding = {"test": {"chunks": (1, 1, 1)}} 2485s 2485s with self.temp_dir() as (d, store): 2485s ds.to_zarr( 2485s store, 2485s mode="w", 2485s encoding=encoding, 2485s write_empty_chunks=write_empty, 2485s ) 2485s 2485s # check expected files after a write 2485s assert_expected_files(expected, store) 2485s 2485s with self.roundtrip_dir( 2485s ds, 2485s store, 2485s save_kwargs={ 2485s "mode": "a", 2485s "append_dim": "Z", 2485s "write_empty_chunks": write_empty, 2485s }, 2485s ) as a_ds: 2485s expected_ds = xr.concat([ds, ds], dim="Z") 2485s 2485s assert_identical(a_ds, expected_ds.compute()) 2485s # add the new files we expect to be created by the append 2486s # that was performed by the roundtrip_dir 2486s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2486s expected.append("1.1.0") 2486s else: 2486s if not has_zarr_v3: 2486s # TODO: remove zarr3 if once zarr issue is fixed 2486s # https://github.com/zarr-developers/zarr-python/issues/2931 2486s expected.extend( 2486s [ 2486s "1.1.0", 2486s "1.0.0", 2486s "1.0.1", 2486s "1.1.1", 2486s ] 2486s ) 2486s else: 2486s expected.append("1.1.0") 2486s if zarr_format_3: 2486s expected = [e.replace(".", "/") for e in expected] 2486s > assert_expected_files(expected, store) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 2486s store = '/tmp/tmpj0p82r77/test.zarr' 2486s 2486s def assert_expected_files(expected: list[str], store: str) -> None: 2486s """Convenience for comparing with actual files written""" 2486s ls = [] 2486s test_root = os.path.join(store, "test") 2486s for root, _, files in os.walk(test_root): 2486s ls.extend( 2486s [ 2486s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2486s for f in files 2486s ] 2486s ) 2486s 2486s > assert set(expected) == set( 2486s [ 2486s file.lstrip("c/") 2486s for file in ls 2486s if (file not in (".zattrs", ".zarray", "zarr.json")) 2486s ] 2486s ) 2486s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 2486s E 2486s E Extra items in the right set: 2486s E '1.0.0' 2486s E '1.0.1' 2486s E '1.1.1' 2486s E Use -v to get more diff 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 2486s _____________ TestZarrDictStore.test_zero_dimensional_variable[3] ______________ 2486s 2486s self = 2486s 2486s def test_zero_dimensional_variable(self) -> None: 2486s expected = create_test_data() 2486s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 2486s expected["bytes_var"] = ([], b"foobar") 2486s expected["string_var"] = ([], "foobar") 2486s > with self.roundtrip(expected) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________________ TestZarrDictStore.test_write_store[3] _____________________ 2486s 2486s self = 2486s 2486s def test_write_store(self) -> None: 2486s expected = create_test_data() 2486s with self.create_store() as store: 2486s expected.dump_to_store(store) 2486s # we need to cf decode the store because it has time and 2486s # non-dimension coordinates 2486s > with xr.decode_cf(store) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 2486s vars, attrs = obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'var1' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________ TestZarrDictStore.test_roundtrip_test_data[3] _________________ 2486s 2486s self = 2486s 2486s def test_roundtrip_test_data(self) -> None: 2486s expected = create_test_data() 2486s > with self.roundtrip(expected) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________________ TestZarrDictStore.test_load[3] ________________________ 2486s 2486s self = 2486s 2486s def test_load(self) -> None: 2486s expected = create_test_data() 2486s 2486s @contextlib.contextmanager 2486s def assert_loads(vars=None): 2486s if vars is None: 2486s vars = expected 2486s with self.roundtrip(expected) as actual: 2486s for k, v in actual.variables.items(): 2486s # IndexVariables are eagerly loaded into memory 2486s assert v._in_memory == (k in actual.dims) 2486s yield actual 2486s for k, v in actual.variables.items(): 2486s if k in vars: 2486s assert v._in_memory 2486s assert_identical(expected, actual) 2486s 2486s with pytest.raises(AssertionError): 2486s # make sure the contextmanager works! 2486s > with assert_loads() as ds: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 2486s with self.roundtrip(expected) as actual: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s __________________ TestZarrDictStore.test_dataset_compute[3] ___________________ 2486s 2486s self = 2486s 2486s def test_dataset_compute(self) -> None: 2486s expected = create_test_data() 2486s 2486s > with self.roundtrip(expected) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______________ TestZarrDictStore.test_roundtrip_object_dtype[3] _______________ 2486s 2486s self = 2486s 2486s def test_roundtrip_object_dtype(self) -> None: 2486s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 2486s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 2486s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 2486s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 2486s strings = np.array(["ab", "cdef", "g"], dtype=object) 2486s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 2486s all_nans = np.array([np.nan, np.nan], dtype=object) 2486s original = Dataset( 2486s { 2486s "floats": ("a", floats), 2486s "floats_nans": ("a", floats_nans), 2486s "bytes": ("b", bytes_), 2486s "bytes_nans": ("b", bytes_nans), 2486s "strings": ("b", strings), 2486s "strings_nans": ("b", strings_nans), 2486s "all_nans": ("c", all_nans), 2486s "nan": ([], np.nan), 2486s } 2486s ) 2486s expected = original.copy(deep=True) 2486s > with self.roundtrip(original) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'nan' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______________ TestZarrDictStore.test_roundtrip_float64_data[3] _______________ 2486s 2486s self = 2486s 2486s def test_roundtrip_float64_data(self) -> None: 2486s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 2486s > with self.roundtrip(expected) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________ TestZarrDictStore.test_orthogonal_indexing[3] _________________ 2486s 2486s self = 2486s 2486s def test_orthogonal_indexing(self) -> None: 2486s in_memory = create_test_data() 2486s > with self.roundtrip(in_memory) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________ TestZarrDictStore.test_vectorized_indexing[3] _________________ 2486s 2486s self = 2486s 2486s def test_vectorized_indexing(self) -> None: 2486s in_memory = create_test_data() 2486s > with self.roundtrip(in_memory) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_vectorized_indexing_negative_step[3] __________ 2486s 2486s self = 2486s 2486s def test_vectorized_indexing_negative_step(self) -> None: 2486s # use dask explicitly when present 2486s open_kwargs: dict[str, Any] | None 2486s if has_dask: 2486s open_kwargs = {"chunks": {}} 2486s else: 2486s open_kwargs = None 2486s in_memory = create_test_data() 2486s 2486s def multiple_indexing(indexers): 2486s # make sure a sequence of lazy indexings certainly works. 2486s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 2486s actual = on_disk["var3"] 2486s expected = in_memory["var3"] 2486s for ind in indexers: 2486s actual = actual.isel(ind) 2486s expected = expected.isel(ind) 2486s # make sure the array is not yet loaded into memory 2486s assert not actual.variable._in_memory 2486s assert_identical(expected, actual.load()) 2486s 2486s # with negative step slice. 2486s indexers = [ 2486s { 2486s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 2486s "dim3": slice(-1, 1, -1), 2486s } 2486s ] 2486s > multiple_indexing(indexers) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 2486s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ______________ TestZarrDictStore.test_outer_indexing_reversed[3] _______________ 2486s 2486s self = 2486s 2486s def test_outer_indexing_reversed(self) -> None: 2486s # regression test for GH6560 2486s ds = xr.Dataset( 2486s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 2486s ) 2486s 2486s > with self.roundtrip(ds) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'z' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ___________________ TestZarrDictStore.test_isel_dataarray[3] ___________________ 2486s 2486s self = 2486s 2486s def test_isel_dataarray(self) -> None: 2486s # Make sure isel works lazily. GH:issue:1688 2486s in_memory = create_test_data() 2486s > with self.roundtrip(in_memory) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _____________ TestZarrDictStore.test_array_type_after_indexing[3] ______________ 2486s 2486s self = 2486s 2486s def test_array_type_after_indexing(self) -> None: 2486s in_memory = create_test_data() 2486s > with self.roundtrip(in_memory) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______________________ TestZarrDictStore.test_dropna[3] _______________________ 2486s 2486s self = 2486s 2486s def test_dropna(self) -> None: 2486s # regression test for GH:issue:1694 2486s a = np.random.randn(4, 3) 2486s a[1, 1] = np.nan 2486s in_memory = xr.Dataset( 2486s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 2486s ) 2486s 2486s assert_identical( 2486s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 2486s ) 2486s 2486s > with self.roundtrip(in_memory) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'a' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________________ TestZarrDictStore.test_ondisk_after_print[3] _________________ 2486s 2486s self = 2486s 2486s def test_ondisk_after_print(self) -> None: 2486s """Make sure print does not load file into memory""" 2486s in_memory = create_test_data() 2486s > with self.roundtrip(in_memory) as on_disk: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s __________ TestZarrDictStore.test_roundtrip_bytes_with_fill_value[3] ___________ 2486s 2486s self = 2486s 2486s def test_roundtrip_bytes_with_fill_value(self) -> None: 2486s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 2486s encoding = {"_FillValue": b"X", "dtype": "S1"} 2486s original = Dataset({"x": ("t", values, {}, encoding)}) 2486s expected = original.copy(deep=True) 2486s > with self.roundtrip(original) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value0-False] ________ 2486s 2486s self = 2486s fill_value = np.int8(-1), exp_fill_warning = False 2486s 2486s @pytest.mark.parametrize( 2486s ("fill_value", "exp_fill_warning"), 2486s [ 2486s (np.int8(-1), False), 2486s (np.uint8(255), True), 2486s (-1, False), 2486s (255, True), 2486s ], 2486s ) 2486s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2486s @contextlib.contextmanager 2486s def _roundtrip_with_warnings(*args, **kwargs): 2486s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2486s if exp_fill_warning and is_np2: 2486s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2486s SerializationWarning, 2486s match="_FillValue attribute can't be represented", 2486s ) 2486s else: 2486s warn_checker = contextlib.nullcontext() 2486s with warn_checker: 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s yield actual 2486s 2486s # regression/numpy2 test for 2486s encoding = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s "dtype": "i1", 2486s } 2486s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2486s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2486s 2486s attributes = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s } 2486s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2486s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2486s encoded = Dataset({"x": ("t", sb, attributes)}) 2486s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2486s 2486s > with _roundtrip_with_warnings(decoded) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Int8' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value1-True] _________ 2486s 2486s self = 2486s fill_value = np.uint8(255), exp_fill_warning = True 2486s 2486s @pytest.mark.parametrize( 2486s ("fill_value", "exp_fill_warning"), 2486s [ 2486s (np.int8(-1), False), 2486s (np.uint8(255), True), 2486s (-1, False), 2486s (255, True), 2486s ], 2486s ) 2486s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2486s @contextlib.contextmanager 2486s def _roundtrip_with_warnings(*args, **kwargs): 2486s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2486s if exp_fill_warning and is_np2: 2486s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2486s SerializationWarning, 2486s match="_FillValue attribute can't be represented", 2486s ) 2486s else: 2486s warn_checker = contextlib.nullcontext() 2486s with warn_checker: 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s yield actual 2486s 2486s # regression/numpy2 test for 2486s encoding = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s "dtype": "i1", 2486s } 2486s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2486s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2486s 2486s attributes = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s } 2486s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2486s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2486s encoded = Dataset({"x": ("t", sb, attributes)}) 2486s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2486s 2486s > with _roundtrip_with_warnings(decoded) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Int8' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________ TestZarrDictStore.test_roundtrip_unsigned[3--1-False] _____________ 2486s 2486s self = 2486s fill_value = -1, exp_fill_warning = False 2486s 2486s @pytest.mark.parametrize( 2486s ("fill_value", "exp_fill_warning"), 2486s [ 2486s (np.int8(-1), False), 2486s (np.uint8(255), True), 2486s (-1, False), 2486s (255, True), 2486s ], 2486s ) 2486s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2486s @contextlib.contextmanager 2486s def _roundtrip_with_warnings(*args, **kwargs): 2486s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2486s if exp_fill_warning and is_np2: 2486s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2486s SerializationWarning, 2486s match="_FillValue attribute can't be represented", 2486s ) 2486s else: 2486s warn_checker = contextlib.nullcontext() 2486s with warn_checker: 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s yield actual 2486s 2486s # regression/numpy2 test for 2486s encoding = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s "dtype": "i1", 2486s } 2486s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2486s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2486s 2486s attributes = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s } 2486s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2486s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2486s encoded = Dataset({"x": ("t", sb, attributes)}) 2486s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2486s 2486s > with _roundtrip_with_warnings(decoded) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Int8' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________ TestZarrDictStore.test_roundtrip_unsigned[3-255-True] _____________ 2486s 2486s self = 2486s fill_value = 255, exp_fill_warning = True 2486s 2486s @pytest.mark.parametrize( 2486s ("fill_value", "exp_fill_warning"), 2486s [ 2486s (np.int8(-1), False), 2486s (np.uint8(255), True), 2486s (-1, False), 2486s (255, True), 2486s ], 2486s ) 2486s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2486s @contextlib.contextmanager 2486s def _roundtrip_with_warnings(*args, **kwargs): 2486s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2486s if exp_fill_warning and is_np2: 2486s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2486s SerializationWarning, 2486s match="_FillValue attribute can't be represented", 2486s ) 2486s else: 2486s warn_checker = contextlib.nullcontext() 2486s with warn_checker: 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s yield actual 2486s 2486s # regression/numpy2 test for 2486s encoding = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s "dtype": "i1", 2486s } 2486s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2486s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2486s 2486s attributes = { 2486s "_FillValue": fill_value, 2486s "_Unsigned": "true", 2486s } 2486s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2486s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2486s encoded = Dataset({"x": ("t", sb, attributes)}) 2486s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2486s 2486s > with _roundtrip_with_warnings(decoded) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2486s with self.roundtrip(*args, **kwargs) as actual: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Int8' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 2486s 2486s self = 2486s 2486s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 2486s original = self._create_cf_dataset() 2486s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'det_lim' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____ TestZarrDictStore.test_coordinate_variables_after_dataset_roundtrip[3] ____ 2486s 2486s self = 2486s 2486s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 2486s original = self._create_cf_dataset() 2486s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'det_lim' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 2486s 2486s self = 2486s 2486s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 2486s self, 2486s ) -> None: 2486s original = self._create_cf_dataset() 2486s # The DataArray roundtrip should have the same warnings as the 2486s # Dataset, but we already tested for those, so just go for the 2486s # new warnings. It would appear that there is no way to tell 2486s # pytest "This warning and also this warning should both be 2486s # present". 2486s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 2486s # needs the to_dataset. The other backends should be fine 2486s # without it. 2486s with pytest.warns( 2486s UserWarning, 2486s match=( 2486s r"Variable\(s\) referenced in bounds not in variables: " 2486s r"\['l(at|ong)itude_bnds'\]" 2486s ), 2486s ): 2486s > with self.roundtrip( 2486s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'ln_p' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s 2486s During handling of the above exception, another exception occurred: 2486s 2486s self = 2486s 2486s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 2486s self, 2486s ) -> None: 2486s original = self._create_cf_dataset() 2486s # The DataArray roundtrip should have the same warnings as the 2486s # Dataset, but we already tested for those, so just go for the 2486s # new warnings. It would appear that there is no way to tell 2486s # pytest "This warning and also this warning should both be 2486s # present". 2486s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 2486s # needs the to_dataset. The other backends should be fine 2486s # without it. 2486s > with pytest.warns( 2486s UserWarning, 2486s match=( 2486s r"Variable\(s\) referenced in bounds not in variables: " 2486s r"\['l(at|ong)itude_bnds'\]" 2486s ), 2486s ): 2486s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 2486s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 2486s 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.')]. 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 2486s ___________________ TestZarrDictStore.test_encoding_kwarg[3] ___________________ 2486s 2486s self = 2486s 2486s def test_encoding_kwarg(self) -> None: 2486s ds = Dataset({"x": ("y", np.arange(10.0))}) 2486s 2486s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 2486s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float32' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________________ TestZarrDictStore.test_default_fill_value[3] _________________ 2486s 2486s self = 2486s 2486s def test_default_fill_value(self) -> None: 2486s # Test default encoding for float: 2486s ds = Dataset({"x": ("y", np.arange(10.0))}) 2486s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 2486s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float32' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord[3] _________ 2486s 2486s self = 2486s 2486s def test_explicitly_omit_fill_value_in_coord(self) -> None: 2486s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 2486s ds.y.encoding["_FillValue"] = None 2486s > with self.roundtrip(ds) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 2486s 2486s self = 2486s 2486s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 2486s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 2486s kwargs = dict(encoding={"y": {"_FillValue": None}}) 2486s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________ TestZarrDictStore.test_encoding_same_dtype[3] _________________ 2486s 2486s self = 2486s 2486s def test_encoding_same_dtype(self) -> None: 2486s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 2486s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 2486s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float32' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ______________ TestZarrDictStore.test_append_overwrite_values[3] _______________ 2486s 2486s self = 2486s 2486s def test_append_overwrite_values(self) -> None: 2486s # regression for GH1215 2486s data = create_test_data() 2486s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 2486s self.save(data, tmp_file, mode="w") 2486s data["var2"][:] = -999 2486s data["var9"] = data["var2"] * 3 2486s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 2486s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-False] ____________ 2486s 2486s self = 2486s consolidated = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s def test_roundtrip_consolidated(self, consolidated) -> None: 2486s expected = create_test_data() 2486s > with self.roundtrip( 2486s expected, 2486s save_kwargs={"consolidated": consolidated}, 2486s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'var1' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-True] _____________ 2486s 2486s self = 2486s consolidated = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s def test_roundtrip_consolidated(self, consolidated) -> None: 2486s expected = create_test_data() 2486s > with self.roundtrip( 2486s expected, 2486s save_kwargs={"consolidated": consolidated}, 2486s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-None] _____________ 2486s 2486s self = 2486s consolidated = None 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s def test_roundtrip_consolidated(self, consolidated) -> None: 2486s expected = create_test_data() 2486s > with self.roundtrip( 2486s expected, 2486s save_kwargs={"consolidated": consolidated}, 2486s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ___________ TestZarrDictStore.test_read_non_consolidated_warning[3] ____________ 2486s 2486s self = 2486s 2486s def test_read_non_consolidated_warning(self) -> None: 2486s expected = create_test_data() 2486s with self.create_zarr_target() as store: 2486s self.save( 2486s expected, store_target=store, consolidated=False, **self.version_kwargs 2486s ) 2486s with pytest.warns( 2486s RuntimeWarning, 2486s match="Failed to open Zarr store with consolidated", 2486s ): 2486s > with xr.open_zarr(store, **self.version_kwargs) as ds: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'var1' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________________ TestZarrDictStore.test_non_existent_store[3] _________________ 2486s 2486s self = 2486s 2486s def test_non_existent_store(self) -> None: 2486s with pytest.raises( 2486s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2486s ): 2486s > xr.open_zarr(f"{uuid.uuid4()}") 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 2486s store = ZarrStore.open_group( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 2486s ) = _get_open_params( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 2486s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 2486s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 2486s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 2486s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2486s raise return_result 2486s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2486s return await coro 2486s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 2486s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 2486s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2486s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2486s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 2486s store = await make_store(store_like, mode=mode, storage_options=storage_options) 2486s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 2486s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 2486s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 2486s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 2486s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 2486s await store._open() 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/6da3de5b-a185-44e2-8283-e3c6a987e555') 2486s 2486s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 2486s if not self.read_only: 2486s self.root.mkdir(parents=True, exist_ok=True) 2486s 2486s if not self.root.exists(): 2486s > raise FileNotFoundError(f"{self.root} does not exist") 2486s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/6da3de5b-a185-44e2-8283-e3c6a987e555 does not exist 2486s 2486s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 2486s 2486s During handling of the above exception, another exception occurred: 2486s 2486s self = 2486s 2486s def test_non_existent_store(self) -> None: 2486s > with pytest.raises( 2486s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2486s ): 2486s E AssertionError: Regex pattern did not match. 2486s E Regex: '(No such file or directory|Unable to find group)' 2486s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/6da3de5b-a185-44e2-8283-e3c6a987e555 does not exist' 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 2486s _____________________ TestZarrDictStore.test_auto_chunk[3] _____________________ 2486s 2486s self = 2486s 2486s @requires_dask 2486s def test_auto_chunk(self) -> None: 2486s original = create_test_data().chunk() 2486s 2486s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________________ TestZarrDictStore.test_manual_chunk[3] ____________________ 2486s 2486s self = 2486s 2486s @requires_dask 2486s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 2486s def test_manual_chunk(self) -> None: 2486s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 2486s 2486s # Using chunks = None should return non-chunked arrays 2486s open_kwargs: dict[str, Any] = {"chunks": None} 2486s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______________ TestZarrDictStore.test_warning_on_bad_chunks[3] ________________ 2486s 2486s self = 2486s 2486s @requires_dask 2486s def test_warning_on_bad_chunks(self) -> None: 2486s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 2486s 2486s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 2486s for chunks in bad_chunks: 2486s kwargs = {"chunks": chunks} 2486s with pytest.warns(UserWarning): 2486s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ______________ TestZarrDictStore.test_write_uneven_dask_chunks[3] ______________ 2486s 2486s self = 2486s 2486s @requires_dask 2486s def test_write_uneven_dask_chunks(self) -> None: 2486s # regression for GH#2225 2486s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 2486s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ___________________ TestZarrDictStore.test_chunk_encoding[3] ___________________ 2486s 2486s self = 2486s 2486s def test_chunk_encoding(self) -> None: 2486s # These datasets have no dask chunks. All chunking specified in 2486s # encoding 2486s data = create_test_data() 2486s chunks = (5, 5) 2486s data["var2"].encoding.update({"chunks": chunks}) 2486s 2486s > with self.roundtrip(data) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ___________________ TestZarrDictStore.test_shard_encoding[3] ___________________ 2486s 2486s self = 2486s 2486s def test_shard_encoding(self) -> None: 2486s # These datasets have no dask chunks. All chunking/sharding specified in 2486s # encoding 2486s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2486s data = create_test_data() 2486s chunks = (1, 1) 2486s shards = (5, 5) 2486s data["var2"].encoding.update({"chunks": chunks}) 2486s data["var2"].encoding.update({"shards": shards}) 2486s > with self.roundtrip(data) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________ TestZarrDictStore.test_write_persistence_modes[3-None] ____________ 2486s 2486s self = 2486s group = None 2486s 2486s @pytest.mark.parametrize("group", [None, "group1"]) 2486s def test_write_persistence_modes(self, group) -> None: 2486s original = create_test_data() 2486s 2486s # overwrite mode 2486s > with self.roundtrip( 2486s original, 2486s save_kwargs={"mode": "w", "group": group}, 2486s open_kwargs={"group": group}, 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ___________ TestZarrDictStore.test_write_persistence_modes[3-group1] ___________ 2486s 2486s self = 2486s group = 'group1' 2486s 2486s @pytest.mark.parametrize("group", [None, "group1"]) 2486s def test_write_persistence_modes(self, group) -> None: 2486s original = create_test_data() 2486s 2486s # overwrite mode 2486s > with self.roundtrip( 2486s original, 2486s save_kwargs={"mode": "w", "group": group}, 2486s open_kwargs={"group": group}, 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________ TestZarrDictStore.test_compressor_encoding[3] _________________ 2486s 2486s self = 2486s 2486s def test_compressor_encoding(self) -> None: 2486s # specify a custom compressor 2486s original = create_test_data() 2486s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2486s encoding_key = "compressors" 2486s # all parameters need to be explicitly specified in order for the comparison to pass below 2486s encoding = { 2486s "serializer": zarr.codecs.BytesCodec(endian="little"), 2486s encoding_key: ( 2486s zarr.codecs.BloscCodec( 2486s cname="zstd", 2486s clevel=3, 2486s shuffle="shuffle", 2486s typesize=8, 2486s blocksize=0, 2486s ), 2486s ), 2486s } 2486s else: 2486s from numcodecs.blosc import Blosc 2486s 2486s encoding_key = "compressors" if has_zarr_v3 else "compressor" 2486s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 2486s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 2486s 2486s save_kwargs = dict(encoding={"var1": encoding}) 2486s 2486s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______________________ TestZarrDictStore.test_group[3] ________________________ 2486s 2486s self = 2486s 2486s def test_group(self) -> None: 2486s original = create_test_data() 2486s group = "some/random/path" 2486s > with self.roundtrip( 2486s original, save_kwargs={"group": group}, open_kwargs={"group": group} 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ____________________ TestZarrDictStore.test_append_write[3] ____________________ 2486s 2486s self = 2486s 2486s def test_append_write(self) -> None: 2486s > super().test_append_write() 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 2486s with self.roundtrip_append(data) as actual: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 2486s self.save(data[[key]], path, mode=mode, **save_kwargs) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 2486s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______ TestZarrDictStore.test_append_with_append_dim_not_set_raises[3] ________ 2486s 2486s self = 2486s 2486s def test_append_with_append_dim_not_set_raises(self) -> None: 2486s ds, ds_to_append, _ = create_append_test_data() 2486s with self.create_zarr_target() as store_target: 2486s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2486s with pytest.raises(ValueError, match="different dimension sizes"): 2486s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'da' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-U] ________ 2486s 2486s self = 2486s dtype = 'U' 2486s 2486s @pytest.mark.parametrize("dtype", ["U", "S"]) 2486s def test_append_string_length_mismatch_works(self, dtype) -> None: 2486s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 2486s # ...but it probably would if we used object dtype 2486s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 2486s expected = xr.concat([ds, ds_to_append], dim="time") 2486s with self.create_zarr_target() as store_target: 2486s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2486s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 2486s _validate_datatypes_for_zarr_append( 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s vname = 'temperature' 2486s existing_var = Size: 24B 2486s [3 values with dtype= Size: 60B 2486s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 2486s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 2486s f"and dataset to append. Store has dtype {existing_var.dtype} but " 2486s f"dataset to append has dtype {new_var.dtype}." 2486s ) 2486s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 2486s dtype = 'S' 2486s 2486s @pytest.mark.parametrize("dtype", ["U", "S"]) 2486s def test_append_string_length_mismatch_works(self, dtype) -> None: 2486s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 2486s # ...but it probably would if we used object dtype 2486s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 2486s expected = xr.concat([ds, ds_to_append], dim="time") 2486s with self.create_zarr_target() as store_target: 2486s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2486s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 2486s _validate_datatypes_for_zarr_append( 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s vname = 'temperature' 2486s existing_var = Size: 6B 2486s [3 values with dtype=|S2] 2486s new_var = Size: 9B 2486s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 2486s 2486s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 2486s """If variable exists in the store, confirm dtype of the data to append is compatible with 2486s existing dtype. 2486s """ 2486s if ( 2486s np.issubdtype(new_var.dtype, np.number) 2486s or np.issubdtype(new_var.dtype, np.datetime64) 2486s or np.issubdtype(new_var.dtype, np.bool_) 2486s or new_var.dtype == object 2486s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 2486s ): 2486s # We can skip dtype equality checks under two conditions: (1) if the var to append is 2486s # new to the dataset, because in this case there is no existing var to compare it to; 2486s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 2486s # we can be confident appending won't cause problems. Examples of dtypes which are not 2486s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 2486s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 2486s f"and dataset to append. Store has dtype {existing_var.dtype} but " 2486s f"dataset to append has dtype {new_var.dtype}." 2486s ) 2486s 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. 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 2486s _____ TestZarrDictStore.test_check_encoding_is_consistent_after_append[3] ______ 2486s 2486s self = 2486s 2486s def test_check_encoding_is_consistent_after_append(self) -> None: 2486s ds, ds_to_append, _ = create_append_test_data() 2486s 2486s # check encoding consistency 2486s with self.create_zarr_target() as store_target: 2486s import numcodecs 2486s 2486s encoding_value: Any 2486s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2486s compressor = zarr.codecs.BloscCodec() 2486s else: 2486s compressor = numcodecs.Blosc() 2486s encoding_key = "compressors" if has_zarr_v3 else "compressor" 2486s encoding_value = (compressor,) if has_zarr_v3 else compressor 2486s 2486s encoding = {"da": {encoding_key: encoding_value}} 2486s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 2486s > original_ds = xr.open_dataset( 2486s store_target, engine="zarr", **self.version_kwargs 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'da' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ______________ TestZarrDictStore.test_append_with_new_variable[3] ______________ 2486s 2486s self = 2486s 2486s def test_append_with_new_variable(self) -> None: 2486s ds, ds_to_append, ds_with_new_var = create_append_test_data() 2486s 2486s # check append mode for new variable 2486s with self.create_zarr_target() as store_target: 2486s combined = xr.concat([ds, ds_to_append], dim="time") 2486s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 2486s assert_identical( 2486s combined, 2486s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'da' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_append_with_append_dim_no_overwrite[3] _________ 2486s 2486s self = 2486s 2486s def test_append_with_append_dim_no_overwrite(self) -> None: 2486s ds, ds_to_append, _ = create_append_test_data() 2486s with self.create_zarr_target() as store_target: 2486s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2486s original = xr.concat([ds, ds_to_append], dim="time") 2486s original2 = xr.concat([original, ds_to_append], dim="time") 2486s 2486s # overwrite a coordinate; 2486s # for mode='a-', this will not get written to the store 2486s # because it does not have the append_dim as a dim 2486s lon = ds_to_append.lon.to_numpy().copy() 2486s lon[:] = -999 2486s ds_to_append["lon"] = lon 2486s > ds_to_append.to_zarr( 2486s store_target, mode="a-", append_dim="time", **self.version_kwargs 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'da' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s __________ TestZarrDictStore.test_to_zarr_compute_false_roundtrip[3] ___________ 2486s 2486s self = 2486s 2486s @requires_dask 2486s def test_to_zarr_compute_false_roundtrip(self) -> None: 2486s from dask.delayed import Delayed 2486s 2486s original = create_test_data().chunk() 2486s 2486s with self.create_zarr_target() as store: 2486s delayed_obj = self.save(original, store, compute=False) 2486s assert isinstance(delayed_obj, Delayed) 2486s 2486s # make sure target store has not been written to yet 2486s with pytest.raises(AssertionError): 2486s > with self.open(store) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'dim2' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _______ TestZarrDictStore.test_to_zarr_append_compute_false_roundtrip[3] _______ 2486s 2486s self = 2486s 2486s @requires_dask 2486s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 2486s from dask.delayed import Delayed 2486s 2486s ds, ds_to_append, _ = create_append_test_data() 2486s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 2486s 2486s with pytest.warns(SerializationWarning): 2486s with self.create_zarr_target() as store: 2486s delayed_obj = self.save(ds, store, compute=False, mode="w") 2486s assert isinstance(delayed_obj, Delayed) 2486s 2486s with pytest.raises(AssertionError): 2486s > with self.open(store) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'da' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________________ TestZarrDictStore.test_save_emptydim[3-False] _________________ 2486s 2486s self = 2486s chunk = False 2486s 2486s @pytest.mark.parametrize("chunk", [False, True]) 2486s def test_save_emptydim(self, chunk) -> None: 2486s if chunk and not has_dask: 2486s pytest.skip("requires dask") 2486s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 2486s if chunk: 2486s ds = ds.chunk({}) # chunk dataset to save dask array 2486s > with self.roundtrip(ds) as ds_reload: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________________ TestZarrDictStore.test_save_emptydim[3-True] _________________ 2486s 2486s self = 2486s chunk = True 2486s 2486s @pytest.mark.parametrize("chunk", [False, True]) 2486s def test_save_emptydim(self, chunk) -> None: 2486s if chunk and not has_dask: 2486s pytest.skip("requires dask") 2486s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 2486s if chunk: 2486s ds = ds.chunk({}) # chunk dataset to save dask array 2486s > with self.roundtrip(ds) as ds_reload: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _____ TestZarrDictStore.test_no_warning_from_open_emptydim_with_chunks[3] ______ 2486s 2486s self = 2486s 2486s @requires_dask 2486s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 2486s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 2486s with assert_no_warnings(): 2486s with warnings.catch_warnings(): 2486s warnings.filterwarnings( 2486s "ignore", 2486s message=".*Zarr format 3 specification.*", 2486s category=UserWarning, 2486s ) 2486s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2486s with self.open(store_target, **open_kwargs) as ds: 2486s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2486s return next(self.gen) 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2486s with xr.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'x' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-False-False-False-False] ________ 2486s 2486s self = 2486s consolidated = False, compute = False, use_dask = False, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-False-False-False-True] _________ 2486s 2486s self = 2486s consolidated = True, compute = False, use_dask = False, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-False-False-False-None] _________ 2486s 2486s self = 2486s consolidated = None, compute = False, use_dask = False, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-False-False-True-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = True, use_dask = False, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-False-True-True] _________ 2486s 2486s self = 2486s consolidated = True, compute = True, use_dask = False, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-False-True-None] _________ 2486s 2486s self = 2486s consolidated = None, compute = True, use_dask = False, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-False-True-False-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = False, use_dask = True, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-True-False-True] _________ 2486s 2486s self = 2486s consolidated = True, compute = False, use_dask = True, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-True-False-None] _________ 2486s 2486s self = 2486s consolidated = None, compute = False, use_dask = True, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-True-True-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = True, use_dask = True, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-True-True-True] __________ 2486s 2486s self = 2486s consolidated = True, compute = True, use_dask = True, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-False-True-True-None] __________ 2486s 2486s self = 2486s consolidated = None, compute = True, use_dask = True, write_empty = False 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-True-False-False-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = False, use_dask = False, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-False-False-True] _________ 2486s 2486s self = 2486s consolidated = True, compute = False, use_dask = False, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-False-False-None] _________ 2486s 2486s self = 2486s consolidated = None, compute = False, use_dask = False, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-False-True-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = True, use_dask = False, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-False-True-True] __________ 2486s 2486s self = 2486s consolidated = True, compute = True, use_dask = False, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-False-True-None] __________ 2486s 2486s self = 2486s consolidated = None, compute = True, use_dask = False, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-True-False-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = False, use_dask = True, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-True-False-True] __________ 2486s 2486s self = 2486s consolidated = True, compute = False, use_dask = True, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-True-False-None] __________ 2486s 2486s self = 2486s consolidated = None, compute = False, use_dask = True, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-True-True-True-False] __________ 2486s 2486s self = 2486s consolidated = False, compute = True, use_dask = True, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s __________ TestZarrDictStore.test_write_region[3-True-True-True-True] __________ 2486s 2486s self = 2486s consolidated = True, compute = True, use_dask = True, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s __________ TestZarrDictStore.test_write_region[3-True-True-True-None] __________ 2486s 2486s self = 2486s consolidated = None, compute = True, use_dask = True, write_empty = True 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s ________ TestZarrDictStore.test_write_region[3-None-False-False-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = False, use_dask = False, write_empty = None 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-None-False-False-True] _________ 2486s 2486s self = 2486s consolidated = True, compute = False, use_dask = False, write_empty = None 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-None-False-False-None] _________ 2486s 2486s self = 2486s consolidated = None, compute = False, use_dask = False, write_empty = None 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s assert_identical(actual, zeros) 2486s for i in range(0, 10, 2): 2486s region = {"x": slice(i, i + 2)} 2486s > nonzeros.isel(region).to_zarr( 2486s store, 2486s region=region, 2486s consolidated=consolidated, 2486s write_empty_chunks=write_empty, 2486s **self.version_kwargs, 2486s ) 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2486s return to_zarr( # type: ignore[call-overload,misc] 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2486s dump_to_store(dataset, zstore, writer, encoding=encoding) 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2486s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2486s k: self.open_store_variable(name=k) for k in existing_variable_names 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-None-False-True-False] _________ 2486s 2486s self = 2486s consolidated = False, compute = True, use_dask = False, write_empty = None 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2486s if zarr_array.fill_value is not None: 2486s attributes["_FillValue"] = zarr_array.fill_value 2486s elif "_FillValue" in attributes: 2486s original_zarr_dtype = zarr_array.metadata.data_type 2486s attributes["_FillValue"] = FillValueCoder.decode( 2486s > attributes["_FillValue"], original_zarr_dtype.value 2486s ) 2486s E AttributeError: 'Float64' object has no attribute 'value' 2486s 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2486s _________ TestZarrDictStore.test_write_region[3-None-False-True-True] __________ 2486s 2486s self = 2486s consolidated = True, compute = True, use_dask = False, write_empty = None 2486s 2486s @pytest.mark.parametrize("consolidated", [False, True, None]) 2486s @pytest.mark.parametrize("compute", [False, True]) 2486s @pytest.mark.parametrize("use_dask", [False, True]) 2486s @pytest.mark.parametrize("write_empty", [False, True, None]) 2486s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2486s if (use_dask or not compute) and not has_dask: 2486s pytest.skip("requires dask") 2486s 2486s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2486s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2486s 2486s if use_dask: 2486s zeros = zeros.chunk(2) 2486s nonzeros = nonzeros.chunk(2) 2486s 2486s with self.create_zarr_target() as store: 2486s zeros.to_zarr( 2486s store, 2486s consolidated=consolidated, 2486s compute=compute, 2486s encoding={"u": dict(chunks=2)}, 2486s **self.version_kwargs, 2486s ) 2486s if compute: 2486s > with xr.open_zarr( 2486s store, consolidated=consolidated, **self.version_kwargs 2486s ) as actual: 2486s 2486s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2486s ds = open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2486s backend_ds = backend.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2486s ds = store_entrypoint.open_dataset( 2486s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2486s vars, attrs = filename_or_obj.load() 2486s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2486s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2486s return Frozen(dict(*args, **kwargs)) 2486s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2486s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2486s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2486s 2486s self = , name = 'u' 2486s 2486s def open_store_variable(self, name): 2486s zarr_array = self.members[name] 2486s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2486s try_nczarr = self._mode == "r" 2486s dimensions, attributes = _get_zarr_dims_and_attrs( 2486s zarr_array, DIMENSION_KEY, try_nczarr 2486s ) 2486s attributes = dict(attributes) 2486s 2486s encoding = { 2486s "chunks": zarr_array.chunks, 2486s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2486s } 2486s 2486s if _zarr_v3(): 2486s encoding.update( 2486s { 2486s "compressors": zarr_array.compressors, 2486s "filters": zarr_array.filters, 2486s "shards": zarr_array.shards, 2486s } 2486s ) 2486s if self.zarr_group.metadata.zarr_format == 3: 2486s encoding.update({"serializer": zarr_array.serializer}) 2486s else: 2486s encoding.update( 2486s { 2486s "compressor": zarr_array.compressor, 2486s "filters": zarr_array.filters, 2486s } 2486s ) 2486s 2486s if self._use_zarr_fill_value_as_mask: 2486s # Setting this attribute triggers CF decoding for missing values 2486s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDictStore.test_write_region[3-None-False-True-None] __________ 2487s 2487s self = 2487s consolidated = None, compute = True, use_dask = False, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDictStore.test_write_region[3-None-True-False-False] _________ 2487s 2487s self = 2487s consolidated = False, compute = False, use_dask = True, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDictStore.test_write_region[3-None-True-False-True] __________ 2487s 2487s self = 2487s consolidated = True, compute = False, use_dask = True, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDictStore.test_write_region[3-None-True-False-None] __________ 2487s 2487s self = 2487s consolidated = None, compute = False, use_dask = True, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDictStore.test_write_region[3-None-True-True-False] __________ 2487s 2487s self = 2487s consolidated = False, compute = True, use_dask = True, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________ TestZarrDictStore.test_write_region[3-None-True-True-True] __________ 2487s 2487s self = 2487s consolidated = True, compute = True, use_dask = True, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________ TestZarrDictStore.test_write_region[3-None-True-True-None] __________ 2487s 2487s self = 2487s consolidated = None, compute = True, use_dask = True, write_empty = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _______________ TestZarrDictStore.test_write_region_mode[3-None] _______________ 2487s 2487s self = 2487s mode = None 2487s 2487s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2487s def test_write_region_mode(self, mode) -> None: 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr(store, **self.version_kwargs) 2487s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2487s > nonzeros.isel(region).to_zarr( 2487s store, region=region, mode=mode, **self.version_kwargs 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDictStore.test_write_region_mode[3-r+] ________________ 2487s 2487s self = 2487s mode = 'r+' 2487s 2487s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2487s def test_write_region_mode(self, mode) -> None: 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr(store, **self.version_kwargs) 2487s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2487s > nonzeros.isel(region).to_zarr( 2487s store, region=region, mode=mode, **self.version_kwargs 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDictStore.test_write_region_mode[3-a] _________________ 2487s 2487s self = 2487s mode = 'a' 2487s 2487s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2487s def test_write_region_mode(self, mode) -> None: 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr(store, **self.version_kwargs) 2487s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2487s > nonzeros.isel(region).to_zarr( 2487s store, region=region, mode=mode, **self.version_kwargs 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________ TestZarrDictStore.test_write_preexisting_override_metadata[3] _________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_write_preexisting_override_metadata(self) -> None: 2487s """Metadata should be overridden if mode="a" but not in mode="r+".""" 2487s original = Dataset( 2487s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 2487s attrs={"global": "original"}, 2487s ) 2487s both_modified = Dataset( 2487s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 2487s attrs={"global": "modified"}, 2487s ) 2487s global_modified = Dataset( 2487s {"u": (("x",), np.ones(10), {"variable": "original"})}, 2487s attrs={"global": "modified"}, 2487s ) 2487s only_new_data = Dataset( 2487s {"u": (("x",), np.ones(10), {"variable": "original"})}, 2487s attrs={"global": "original"}, 2487s ) 2487s 2487s with self.create_zarr_target() as store: 2487s original.to_zarr(store, compute=False, **self.version_kwargs) 2487s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDictStore.test_encoding_chunksizes[3] _________________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_encoding_chunksizes(self) -> None: 2487s # regression test for GH2278 2487s # see also test_encoding_chunksizes_unlimited 2487s nx, ny, nt = 4, 4, 5 2487s original = xr.Dataset( 2487s {}, 2487s coords={ 2487s "x": np.arange(nx), 2487s "y": np.arange(ny), 2487s "t": np.arange(nt), 2487s }, 2487s ) 2487s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 2487s original = original.chunk({"t": 1, "x": 2, "y": 2}) 2487s 2487s > with self.roundtrip(original) as ds1: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'v' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDictStore.test_chunk_encoding_with_partial_dask_chunks[3] _______ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 2487s original = xr.Dataset( 2487s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 2487s ).chunk({"a": 3}) 2487s 2487s > with self.roundtrip( 2487s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 2487s ) as ds1: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDictStore.test_open_zarr_use_cftime[3] ________________ 2487s 2487s self = 2487s 2487s @requires_cftime 2487s def test_open_zarr_use_cftime(self) -> None: 2487s ds = create_test_data() 2487s with self.create_zarr_target() as store_target: 2487s ds.to_zarr(store_target, **self.version_kwargs) 2487s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDictStore.test_write_read_select_write[3] _______________ 2487s 2487s self = 2487s 2487s def test_write_read_select_write(self) -> None: 2487s # Test for https://github.com/pydata/xarray/issues/4084 2487s ds = create_test_data() 2487s 2487s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 2487s with self.create_zarr_target() as initial_store: 2487s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 2487s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________________ TestZarrDictStore.test_attributes[3-obj1] ___________________ 2487s 2487s self = 2487s obj = Size: 8B 2487s array(nan) 2487s Attributes: 2487s good: {'key': 'value'} 2487s 2487s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 2487s def test_attributes(self, obj) -> None: 2487s obj = obj.copy() 2487s 2487s obj.attrs["good"] = {"key": "value"} 2487s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 2487s with self.create_zarr_target() as store_target: 2487s ds.to_zarr(store_target, **self.version_kwargs) 2487s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'foo' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 2487s 2487s self = 2487s dtype = 'datetime64[ns]' 2487s 2487s @requires_dask 2487s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 2487s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 2487s # Generalized from @malmans2's test in PR #8253 2487s original = create_test_data().astype(dtype).chunk(1) 2487s > with self.roundtrip( 2487s original, 2487s open_kwargs={ 2487s "chunks": {}, 2487s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 2487s }, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] __ 2487s 2487s self = 2487s dtype = 'timedelta64[ns]' 2487s 2487s @requires_dask 2487s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 2487s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 2487s # Generalized from @malmans2's test in PR #8253 2487s original = create_test_data().astype(dtype).chunk(1) 2487s > with self.roundtrip( 2487s original, 2487s open_kwargs={ 2487s "chunks": {}, 2487s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 2487s }, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ___________ TestZarrDictStore.test_zarr_fill_value_setting[3-float] ____________ 2487s 2487s self = 2487s dtype = 2487s 2487s @requires_dask 2487s @pytest.mark.parametrize("dtype", [int, float]) 2487s def test_zarr_fill_value_setting(self, dtype): 2487s # When zarr_format=2, _FillValue sets fill_value 2487s # When zarr_format=3, fill_value is set independently 2487s # We test this by writing a dask array with compute=False, 2487s # on read we should receive chunks filled with `fill_value` 2487s fv = -1 2487s ds = xr.Dataset( 2487s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 2487s ) 2487s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 2487s 2487s zarr_format_2 = ( 2487s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 2487s ) or not has_zarr_v3 2487s if zarr_format_2: 2487s attr = "_FillValue" 2487s expected.foo.attrs[attr] = fv 2487s else: 2487s attr = "fill_value" 2487s if dtype is float: 2487s # for floats, Xarray inserts a default `np.nan` 2487s expected.foo.attrs["_FillValue"] = np.nan 2487s 2487s # turn off all decoding so we see what Zarr returns to us. 2487s # Since chunks, are not written, we should receive on `fill_value` 2487s open_kwargs = { 2487s "mask_and_scale": False, 2487s "consolidated": False, 2487s "use_zarr_fill_value_as_mask": False, 2487s } 2487s save_kwargs = dict(compute=False, consolidated=False) 2487s > with self.roundtrip( 2487s ds, 2487s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 2487s open_kwargs=open_kwargs, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'foo' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ___________ TestZarrDirectoryStore.test_zero_dimensional_variable[3] ___________ 2487s 2487s self = 2487s 2487s def test_zero_dimensional_variable(self) -> None: 2487s expected = create_test_data() 2487s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 2487s expected["bytes_var"] = ([], b"foobar") 2487s expected["string_var"] = ([], "foobar") 2487s > with self.roundtrip(expected) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________________ TestZarrDirectoryStore.test_write_store[3] __________________ 2487s 2487s self = 2487s 2487s def test_write_store(self) -> None: 2487s expected = create_test_data() 2487s with self.create_store() as store: 2487s expected.dump_to_store(store) 2487s # we need to cf decode the store because it has time and 2487s # non-dimension coordinates 2487s > with xr.decode_cf(store) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 2487s vars, attrs = obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'var3' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_roundtrip_test_data[3] ______________ 2487s 2487s self = 2487s 2487s def test_roundtrip_test_data(self) -> None: 2487s expected = create_test_data() 2487s > with self.roundtrip(expected) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____________________ TestZarrDirectoryStore.test_load[3] ______________________ 2487s 2487s self = 2487s 2487s def test_load(self) -> None: 2487s expected = create_test_data() 2487s 2487s @contextlib.contextmanager 2487s def assert_loads(vars=None): 2487s if vars is None: 2487s vars = expected 2487s with self.roundtrip(expected) as actual: 2487s for k, v in actual.variables.items(): 2487s # IndexVariables are eagerly loaded into memory 2487s assert v._in_memory == (k in actual.dims) 2487s yield actual 2487s for k, v in actual.variables.items(): 2487s if k in vars: 2487s assert v._in_memory 2487s assert_identical(expected, actual) 2487s 2487s with pytest.raises(AssertionError): 2487s # make sure the contextmanager works! 2487s > with assert_loads() as ds: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 2487s with self.roundtrip(expected) as actual: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDirectoryStore.test_dataset_compute[3] ________________ 2487s 2487s self = 2487s 2487s def test_dataset_compute(self) -> None: 2487s expected = create_test_data() 2487s 2487s > with self.roundtrip(expected) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ____________ TestZarrDirectoryStore.test_roundtrip_object_dtype[3] _____________ 2487s 2487s self = 2487s 2487s def test_roundtrip_object_dtype(self) -> None: 2487s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 2487s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 2487s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 2487s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 2487s strings = np.array(["ab", "cdef", "g"], dtype=object) 2487s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 2487s all_nans = np.array([np.nan, np.nan], dtype=object) 2487s original = Dataset( 2487s { 2487s "floats": ("a", floats), 2487s "floats_nans": ("a", floats_nans), 2487s "bytes": ("b", bytes_), 2487s "bytes_nans": ("b", bytes_nans), 2487s "strings": ("b", strings), 2487s "strings_nans": ("b", strings_nans), 2487s "all_nans": ("c", all_nans), 2487s "nan": ([], np.nan), 2487s } 2487s ) 2487s expected = original.copy(deep=True) 2487s > with self.roundtrip(original) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'nan' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ____________ TestZarrDirectoryStore.test_roundtrip_float64_data[3] _____________ 2487s 2487s self = 2487s 2487s def test_roundtrip_float64_data(self) -> None: 2487s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 2487s > with self.roundtrip(expected) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_orthogonal_indexing[3] ______________ 2487s 2487s self = 2487s 2487s def test_orthogonal_indexing(self) -> None: 2487s in_memory = create_test_data() 2487s > with self.roundtrip(in_memory) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_vectorized_indexing[3] ______________ 2487s 2487s self = 2487s 2487s def test_vectorized_indexing(self) -> None: 2487s in_memory = create_test_data() 2487s > with self.roundtrip(in_memory) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _______ TestZarrDirectoryStore.test_vectorized_indexing_negative_step[3] _______ 2487s 2487s self = 2487s 2487s def test_vectorized_indexing_negative_step(self) -> None: 2487s # use dask explicitly when present 2487s open_kwargs: dict[str, Any] | None 2487s if has_dask: 2487s open_kwargs = {"chunks": {}} 2487s else: 2487s open_kwargs = None 2487s in_memory = create_test_data() 2487s 2487s def multiple_indexing(indexers): 2487s # make sure a sequence of lazy indexings certainly works. 2487s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 2487s actual = on_disk["var3"] 2487s expected = in_memory["var3"] 2487s for ind in indexers: 2487s actual = actual.isel(ind) 2487s expected = expected.isel(ind) 2487s # make sure the array is not yet loaded into memory 2487s assert not actual.variable._in_memory 2487s assert_identical(expected, actual.load()) 2487s 2487s # with negative step slice. 2487s indexers = [ 2487s { 2487s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 2487s "dim3": slice(-1, 1, -1), 2487s } 2487s ] 2487s > multiple_indexing(indexers) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 2487s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ____________ TestZarrDirectoryStore.test_outer_indexing_reversed[3] ____________ 2487s 2487s self = 2487s 2487s def test_outer_indexing_reversed(self) -> None: 2487s # regression test for GH6560 2487s ds = xr.Dataset( 2487s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 2487s ) 2487s 2487s > with self.roundtrip(ds) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'z' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDirectoryStore.test_isel_dataarray[3] _________________ 2487s 2487s self = 2487s 2487s def test_isel_dataarray(self) -> None: 2487s # Make sure isel works lazily. GH:issue:1688 2487s in_memory = create_test_data() 2487s > with self.roundtrip(in_memory) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ___________ TestZarrDirectoryStore.test_array_type_after_indexing[3] ___________ 2487s 2487s self = 2487s 2487s def test_array_type_after_indexing(self) -> None: 2487s in_memory = create_test_data() 2487s > with self.roundtrip(in_memory) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ____________________ TestZarrDirectoryStore.test_dropna[3] _____________________ 2487s 2487s self = 2487s 2487s def test_dropna(self) -> None: 2487s # regression test for GH:issue:1694 2487s a = np.random.randn(4, 3) 2487s a[1, 1] = np.nan 2487s in_memory = xr.Dataset( 2487s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 2487s ) 2487s 2487s assert_identical( 2487s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 2487s ) 2487s 2487s > with self.roundtrip(in_memory) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'a' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_ondisk_after_print[3] _______________ 2487s 2487s self = 2487s 2487s def test_ondisk_after_print(self) -> None: 2487s """Make sure print does not load file into memory""" 2487s in_memory = create_test_data() 2487s > with self.roundtrip(in_memory) as on_disk: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________ TestZarrDirectoryStore.test_roundtrip_bytes_with_fill_value[3] ________ 2487s 2487s self = 2487s 2487s def test_roundtrip_bytes_with_fill_value(self) -> None: 2487s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 2487s encoding = {"_FillValue": b"X", "dtype": "S1"} 2487s original = Dataset({"x": ("t", values, {}, encoding)}) 2487s expected = original.copy(deep=True) 2487s > with self.roundtrip(original) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value0-False] ______ 2487s 2487s self = 2487s fill_value = np.int8(-1), exp_fill_warning = False 2487s 2487s @pytest.mark.parametrize( 2487s ("fill_value", "exp_fill_warning"), 2487s [ 2487s (np.int8(-1), False), 2487s (np.uint8(255), True), 2487s (-1, False), 2487s (255, True), 2487s ], 2487s ) 2487s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2487s @contextlib.contextmanager 2487s def _roundtrip_with_warnings(*args, **kwargs): 2487s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2487s if exp_fill_warning and is_np2: 2487s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2487s SerializationWarning, 2487s match="_FillValue attribute can't be represented", 2487s ) 2487s else: 2487s warn_checker = contextlib.nullcontext() 2487s with warn_checker: 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s yield actual 2487s 2487s # regression/numpy2 test for 2487s encoding = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s "dtype": "i1", 2487s } 2487s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2487s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2487s 2487s attributes = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s } 2487s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2487s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2487s encoded = Dataset({"x": ("t", sb, attributes)}) 2487s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2487s 2487s > with _roundtrip_with_warnings(decoded) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Int8' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value1-True] ______ 2487s 2487s self = 2487s fill_value = np.uint8(255), exp_fill_warning = True 2487s 2487s @pytest.mark.parametrize( 2487s ("fill_value", "exp_fill_warning"), 2487s [ 2487s (np.int8(-1), False), 2487s (np.uint8(255), True), 2487s (-1, False), 2487s (255, True), 2487s ], 2487s ) 2487s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2487s @contextlib.contextmanager 2487s def _roundtrip_with_warnings(*args, **kwargs): 2487s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2487s if exp_fill_warning and is_np2: 2487s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2487s SerializationWarning, 2487s match="_FillValue attribute can't be represented", 2487s ) 2487s else: 2487s warn_checker = contextlib.nullcontext() 2487s with warn_checker: 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s yield actual 2487s 2487s # regression/numpy2 test for 2487s encoding = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s "dtype": "i1", 2487s } 2487s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2487s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2487s 2487s attributes = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s } 2487s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2487s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2487s encoded = Dataset({"x": ("t", sb, attributes)}) 2487s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2487s 2487s > with _roundtrip_with_warnings(decoded) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Int8' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3--1-False] __________ 2487s 2487s self = 2487s fill_value = -1, exp_fill_warning = False 2487s 2487s @pytest.mark.parametrize( 2487s ("fill_value", "exp_fill_warning"), 2487s [ 2487s (np.int8(-1), False), 2487s (np.uint8(255), True), 2487s (-1, False), 2487s (255, True), 2487s ], 2487s ) 2487s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2487s @contextlib.contextmanager 2487s def _roundtrip_with_warnings(*args, **kwargs): 2487s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2487s if exp_fill_warning and is_np2: 2487s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2487s SerializationWarning, 2487s match="_FillValue attribute can't be represented", 2487s ) 2487s else: 2487s warn_checker = contextlib.nullcontext() 2487s with warn_checker: 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s yield actual 2487s 2487s # regression/numpy2 test for 2487s encoding = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s "dtype": "i1", 2487s } 2487s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2487s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2487s 2487s attributes = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s } 2487s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2487s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2487s encoded = Dataset({"x": ("t", sb, attributes)}) 2487s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2487s 2487s > with _roundtrip_with_warnings(decoded) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Int8' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3-255-True] __________ 2487s 2487s self = 2487s fill_value = 255, exp_fill_warning = True 2487s 2487s @pytest.mark.parametrize( 2487s ("fill_value", "exp_fill_warning"), 2487s [ 2487s (np.int8(-1), False), 2487s (np.uint8(255), True), 2487s (-1, False), 2487s (255, True), 2487s ], 2487s ) 2487s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2487s @contextlib.contextmanager 2487s def _roundtrip_with_warnings(*args, **kwargs): 2487s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2487s if exp_fill_warning and is_np2: 2487s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2487s SerializationWarning, 2487s match="_FillValue attribute can't be represented", 2487s ) 2487s else: 2487s warn_checker = contextlib.nullcontext() 2487s with warn_checker: 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s yield actual 2487s 2487s # regression/numpy2 test for 2487s encoding = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s "dtype": "i1", 2487s } 2487s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2487s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2487s 2487s attributes = { 2487s "_FillValue": fill_value, 2487s "_Unsigned": "true", 2487s } 2487s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2487s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2487s encoded = Dataset({"x": ("t", sb, attributes)}) 2487s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2487s 2487s > with _roundtrip_with_warnings(decoded) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2487s with self.roundtrip(*args, **kwargs) as actual: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Int8' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 2487s 2487s self = 2487s 2487s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 2487s original = self._create_cf_dataset() 2487s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'det_lim' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _ TestZarrDirectoryStore.test_coordinate_variables_after_dataset_roundtrip[3] __ 2487s 2487s self = 2487s 2487s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 2487s original = self._create_cf_dataset() 2487s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'det_lim' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 2487s 2487s self = 2487s 2487s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 2487s self, 2487s ) -> None: 2487s original = self._create_cf_dataset() 2487s # The DataArray roundtrip should have the same warnings as the 2487s # Dataset, but we already tested for those, so just go for the 2487s # new warnings. It would appear that there is no way to tell 2487s # pytest "This warning and also this warning should both be 2487s # present". 2487s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 2487s # needs the to_dataset. The other backends should be fine 2487s # without it. 2487s with pytest.warns( 2487s UserWarning, 2487s match=( 2487s r"Variable\(s\) referenced in bounds not in variables: " 2487s r"\['l(at|ong)itude_bnds'\]" 2487s ), 2487s ): 2487s > with self.roundtrip( 2487s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'ln_p' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s 2487s During handling of the above exception, another exception occurred: 2487s 2487s self = 2487s 2487s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 2487s self, 2487s ) -> None: 2487s original = self._create_cf_dataset() 2487s # The DataArray roundtrip should have the same warnings as the 2487s # Dataset, but we already tested for those, so just go for the 2487s # new warnings. It would appear that there is no way to tell 2487s # pytest "This warning and also this warning should both be 2487s # present". 2487s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 2487s # needs the to_dataset. The other backends should be fine 2487s # without it. 2487s > with pytest.warns( 2487s UserWarning, 2487s match=( 2487s r"Variable\(s\) referenced in bounds not in variables: " 2487s r"\['l(at|ong)itude_bnds'\]" 2487s ), 2487s ): 2487s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 2487s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 2487s 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.')]. 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 2487s ________________ TestZarrDirectoryStore.test_encoding_kwarg[3] _________________ 2487s 2487s self = 2487s 2487s def test_encoding_kwarg(self) -> None: 2487s ds = Dataset({"x": ("y", np.arange(10.0))}) 2487s 2487s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 2487s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float32' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_default_fill_value[3] _______________ 2487s 2487s self = 2487s 2487s def test_default_fill_value(self) -> None: 2487s # Test default encoding for float: 2487s ds = Dataset({"x": ("y", np.arange(10.0))}) 2487s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 2487s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float32' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord[3] ______ 2487s 2487s self = 2487s 2487s def test_explicitly_omit_fill_value_in_coord(self) -> None: 2487s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 2487s ds.y.encoding["_FillValue"] = None 2487s > with self.roundtrip(ds) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 2487s 2487s self = 2487s 2487s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 2487s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 2487s kwargs = dict(encoding={"y": {"_FillValue": None}}) 2487s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_encoding_same_dtype[3] ______________ 2487s 2487s self = 2487s 2487s def test_encoding_same_dtype(self) -> None: 2487s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 2487s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 2487s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float32' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ____________ TestZarrDirectoryStore.test_append_overwrite_values[3] ____________ 2487s 2487s self = 2487s 2487s def test_append_overwrite_values(self) -> None: 2487s # regression for GH1215 2487s data = create_test_data() 2487s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 2487s self.save(data, tmp_file, mode="w") 2487s data["var2"][:] = -999 2487s data["var9"] = data["var2"] * 3 2487s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 2487s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-False] __________ 2487s 2487s self = 2487s consolidated = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s def test_roundtrip_consolidated(self, consolidated) -> None: 2487s expected = create_test_data() 2487s > with self.roundtrip( 2487s expected, 2487s save_kwargs={"consolidated": consolidated}, 2487s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-True] __________ 2487s 2487s self = 2487s consolidated = True 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s def test_roundtrip_consolidated(self, consolidated) -> None: 2487s expected = create_test_data() 2487s > with self.roundtrip( 2487s expected, 2487s save_kwargs={"consolidated": consolidated}, 2487s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-None] __________ 2487s 2487s self = 2487s consolidated = None 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s def test_roundtrip_consolidated(self, consolidated) -> None: 2487s expected = create_test_data() 2487s > with self.roundtrip( 2487s expected, 2487s save_kwargs={"consolidated": consolidated}, 2487s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDirectoryStore.test_read_non_consolidated_warning[3] _________ 2487s 2487s self = 2487s 2487s def test_read_non_consolidated_warning(self) -> None: 2487s expected = create_test_data() 2487s with self.create_zarr_target() as store: 2487s self.save( 2487s expected, store_target=store, consolidated=False, **self.version_kwargs 2487s ) 2487s with pytest.warns( 2487s RuntimeWarning, 2487s match="Failed to open Zarr store with consolidated", 2487s ): 2487s > with xr.open_zarr(store, **self.version_kwargs) as ds: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_non_existent_store[3] _______________ 2487s 2487s self = 2487s 2487s def test_non_existent_store(self) -> None: 2487s with pytest.raises( 2487s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2487s ): 2487s > xr.open_zarr(f"{uuid.uuid4()}") 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 2487s store = ZarrStore.open_group( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 2487s ) = _get_open_params( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 2487s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 2487s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 2487s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 2487s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2487s raise return_result 2487s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2487s return await coro 2487s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 2487s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 2487s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2487s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2487s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 2487s store = await make_store(store_like, mode=mode, storage_options=storage_options) 2487s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 2487s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 2487s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 2487s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 2487s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 2487s await store._open() 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/02d507fa-02e3-4a31-85f7-299977fb47fe') 2487s 2487s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 2487s if not self.read_only: 2487s self.root.mkdir(parents=True, exist_ok=True) 2487s 2487s if not self.root.exists(): 2487s > raise FileNotFoundError(f"{self.root} does not exist") 2487s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/02d507fa-02e3-4a31-85f7-299977fb47fe does not exist 2487s 2487s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 2487s 2487s During handling of the above exception, another exception occurred: 2487s 2487s self = 2487s 2487s def test_non_existent_store(self) -> None: 2487s > with pytest.raises( 2487s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2487s ): 2487s E AssertionError: Regex pattern did not match. 2487s E Regex: '(No such file or directory|Unable to find group)' 2487s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/02d507fa-02e3-4a31-85f7-299977fb47fe does not exist' 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 2487s __________________ TestZarrDirectoryStore.test_auto_chunk[3] ___________________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_auto_chunk(self) -> None: 2487s original = create_test_data().chunk() 2487s 2487s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________________ TestZarrDirectoryStore.test_manual_chunk[3] __________________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 2487s def test_manual_chunk(self) -> None: 2487s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 2487s 2487s # Using chunks = None should return non-chunked arrays 2487s open_kwargs: dict[str, Any] = {"chunks": None} 2487s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____________ TestZarrDirectoryStore.test_warning_on_bad_chunks[3] _____________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_warning_on_bad_chunks(self) -> None: 2487s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 2487s 2487s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 2487s for chunks in bad_chunks: 2487s kwargs = {"chunks": chunks} 2487s with pytest.warns(UserWarning): 2487s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ___________ TestZarrDirectoryStore.test_write_uneven_dask_chunks[3] ____________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_write_uneven_dask_chunks(self) -> None: 2487s # regression for GH#2225 2487s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 2487s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDirectoryStore.test_chunk_encoding[3] _________________ 2487s 2487s self = 2487s 2487s def test_chunk_encoding(self) -> None: 2487s # These datasets have no dask chunks. All chunking specified in 2487s # encoding 2487s data = create_test_data() 2487s chunks = (5, 5) 2487s data["var2"].encoding.update({"chunks": chunks}) 2487s 2487s > with self.roundtrip(data) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________________ TestZarrDirectoryStore.test_shard_encoding[3] _________________ 2487s 2487s self = 2487s 2487s def test_shard_encoding(self) -> None: 2487s # These datasets have no dask chunks. All chunking/sharding specified in 2487s # encoding 2487s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2487s data = create_test_data() 2487s chunks = (1, 1) 2487s shards = (5, 5) 2487s data["var2"].encoding.update({"chunks": chunks}) 2487s data["var2"].encoding.update({"shards": shards}) 2487s > with self.roundtrip(data) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________ TestZarrDirectoryStore.test_write_persistence_modes[3-None] __________ 2487s 2487s self = 2487s group = None 2487s 2487s @pytest.mark.parametrize("group", [None, "group1"]) 2487s def test_write_persistence_modes(self, group) -> None: 2487s original = create_test_data() 2487s 2487s # overwrite mode 2487s > with self.roundtrip( 2487s original, 2487s save_kwargs={"mode": "w", "group": group}, 2487s open_kwargs={"group": group}, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________ TestZarrDirectoryStore.test_write_persistence_modes[3-group1] _________ 2487s 2487s self = 2487s group = 'group1' 2487s 2487s @pytest.mark.parametrize("group", [None, "group1"]) 2487s def test_write_persistence_modes(self, group) -> None: 2487s original = create_test_data() 2487s 2487s # overwrite mode 2487s > with self.roundtrip( 2487s original, 2487s save_kwargs={"mode": "w", "group": group}, 2487s open_kwargs={"group": group}, 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_compressor_encoding[3] ______________ 2487s 2487s self = 2487s 2487s def test_compressor_encoding(self) -> None: 2487s # specify a custom compressor 2487s original = create_test_data() 2487s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2487s encoding_key = "compressors" 2487s # all parameters need to be explicitly specified in order for the comparison to pass below 2487s encoding = { 2487s "serializer": zarr.codecs.BytesCodec(endian="little"), 2487s encoding_key: ( 2487s zarr.codecs.BloscCodec( 2487s cname="zstd", 2487s clevel=3, 2487s shuffle="shuffle", 2487s typesize=8, 2487s blocksize=0, 2487s ), 2487s ), 2487s } 2487s else: 2487s from numcodecs.blosc import Blosc 2487s 2487s encoding_key = "compressors" if has_zarr_v3 else "compressor" 2487s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 2487s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 2487s 2487s save_kwargs = dict(encoding={"var1": encoding}) 2487s 2487s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____________________ TestZarrDirectoryStore.test_group[3] _____________________ 2487s 2487s self = 2487s 2487s def test_group(self) -> None: 2487s original = create_test_data() 2487s group = "some/random/path" 2487s > with self.roundtrip( 2487s original, save_kwargs={"group": group}, open_kwargs={"group": group} 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _________________ TestZarrDirectoryStore.test_append_write[3] __________________ 2487s 2487s self = 2487s 2487s def test_append_write(self) -> None: 2487s > super().test_append_write() 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 2487s with self.roundtrip_append(data) as actual: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 2487s self.save(data[[key]], path, mode=mode, **save_kwargs) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 2487s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____ TestZarrDirectoryStore.test_append_with_append_dim_not_set_raises[3] _____ 2487s 2487s self = 2487s 2487s def test_append_with_append_dim_not_set_raises(self) -> None: 2487s ds, ds_to_append, _ = create_append_test_data() 2487s with self.create_zarr_target() as store_target: 2487s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2487s with pytest.raises(ValueError, match="different dimension sizes"): 2487s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'da' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-U] _____ 2487s 2487s self = 2487s dtype = 'U' 2487s 2487s @pytest.mark.parametrize("dtype", ["U", "S"]) 2487s def test_append_string_length_mismatch_works(self, dtype) -> None: 2487s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 2487s # ...but it probably would if we used object dtype 2487s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 2487s expected = xr.concat([ds, ds_to_append], dim="time") 2487s with self.create_zarr_target() as store_target: 2487s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2487s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 2487s _validate_datatypes_for_zarr_append( 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s vname = 'temperature' 2487s existing_var = Size: 24B 2487s [3 values with dtype= Size: 60B 2487s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 2487s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 2487s f"and dataset to append. Store has dtype {existing_var.dtype} but " 2487s f"dataset to append has dtype {new_var.dtype}." 2487s ) 2487s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 2487s dtype = 'S' 2487s 2487s @pytest.mark.parametrize("dtype", ["U", "S"]) 2487s def test_append_string_length_mismatch_works(self, dtype) -> None: 2487s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 2487s # ...but it probably would if we used object dtype 2487s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 2487s expected = xr.concat([ds, ds_to_append], dim="time") 2487s with self.create_zarr_target() as store_target: 2487s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2487s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 2487s _validate_datatypes_for_zarr_append( 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s vname = 'temperature' 2487s existing_var = Size: 6B 2487s [3 values with dtype=|S2] 2487s new_var = Size: 9B 2487s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 2487s 2487s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 2487s """If variable exists in the store, confirm dtype of the data to append is compatible with 2487s existing dtype. 2487s """ 2487s if ( 2487s np.issubdtype(new_var.dtype, np.number) 2487s or np.issubdtype(new_var.dtype, np.datetime64) 2487s or np.issubdtype(new_var.dtype, np.bool_) 2487s or new_var.dtype == object 2487s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 2487s ): 2487s # We can skip dtype equality checks under two conditions: (1) if the var to append is 2487s # new to the dataset, because in this case there is no existing var to compare it to; 2487s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 2487s # we can be confident appending won't cause problems. Examples of dtypes which are not 2487s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 2487s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 2487s f"and dataset to append. Store has dtype {existing_var.dtype} but " 2487s f"dataset to append has dtype {new_var.dtype}." 2487s ) 2487s 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. 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 2487s ___ TestZarrDirectoryStore.test_check_encoding_is_consistent_after_append[3] ___ 2487s 2487s self = 2487s 2487s def test_check_encoding_is_consistent_after_append(self) -> None: 2487s ds, ds_to_append, _ = create_append_test_data() 2487s 2487s # check encoding consistency 2487s with self.create_zarr_target() as store_target: 2487s import numcodecs 2487s 2487s encoding_value: Any 2487s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2487s compressor = zarr.codecs.BloscCodec() 2487s else: 2487s compressor = numcodecs.Blosc() 2487s encoding_key = "compressors" if has_zarr_v3 else "compressor" 2487s encoding_value = (compressor,) if has_zarr_v3 else compressor 2487s 2487s encoding = {"da": {encoding_key: encoding_value}} 2487s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 2487s > original_ds = xr.open_dataset( 2487s store_target, engine="zarr", **self.version_kwargs 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'da' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ___________ TestZarrDirectoryStore.test_append_with_new_variable[3] ____________ 2487s 2487s self = 2487s 2487s def test_append_with_new_variable(self) -> None: 2487s ds, ds_to_append, ds_with_new_var = create_append_test_data() 2487s 2487s # check append mode for new variable 2487s with self.create_zarr_target() as store_target: 2487s combined = xr.concat([ds, ds_to_append], dim="time") 2487s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 2487s assert_identical( 2487s combined, 2487s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'da' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_append_with_append_dim_no_overwrite[3] ______ 2487s 2487s self = 2487s 2487s def test_append_with_append_dim_no_overwrite(self) -> None: 2487s ds, ds_to_append, _ = create_append_test_data() 2487s with self.create_zarr_target() as store_target: 2487s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2487s original = xr.concat([ds, ds_to_append], dim="time") 2487s original2 = xr.concat([original, ds_to_append], dim="time") 2487s 2487s # overwrite a coordinate; 2487s # for mode='a-', this will not get written to the store 2487s # because it does not have the append_dim as a dim 2487s lon = ds_to_append.lon.to_numpy().copy() 2487s lon[:] = -999 2487s ds_to_append["lon"] = lon 2487s > ds_to_append.to_zarr( 2487s store_target, mode="a-", append_dim="time", **self.version_kwargs 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'da' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ________ TestZarrDirectoryStore.test_to_zarr_compute_false_roundtrip[3] ________ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_to_zarr_compute_false_roundtrip(self) -> None: 2487s from dask.delayed import Delayed 2487s 2487s original = create_test_data().chunk() 2487s 2487s with self.create_zarr_target() as store: 2487s delayed_obj = self.save(original, store, compute=False) 2487s assert isinstance(delayed_obj, Delayed) 2487s 2487s # make sure target store has not been written to yet 2487s with pytest.raises(AssertionError): 2487s > with self.open(store) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'dim2' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ____ TestZarrDirectoryStore.test_to_zarr_append_compute_false_roundtrip[3] _____ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 2487s from dask.delayed import Delayed 2487s 2487s ds, ds_to_append, _ = create_append_test_data() 2487s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 2487s 2487s with pytest.warns(SerializationWarning): 2487s with self.create_zarr_target() as store: 2487s delayed_obj = self.save(ds, store, compute=False, mode="w") 2487s assert isinstance(delayed_obj, Delayed) 2487s 2487s with pytest.raises(AssertionError): 2487s > with self.open(store) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'da' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_save_emptydim[3-False] ______________ 2487s 2487s self = 2487s chunk = False 2487s 2487s @pytest.mark.parametrize("chunk", [False, True]) 2487s def test_save_emptydim(self, chunk) -> None: 2487s if chunk and not has_dask: 2487s pytest.skip("requires dask") 2487s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 2487s if chunk: 2487s ds = ds.chunk({}) # chunk dataset to save dask array 2487s > with self.roundtrip(ds) as ds_reload: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______________ TestZarrDirectoryStore.test_save_emptydim[3-True] _______________ 2487s 2487s self = 2487s chunk = True 2487s 2487s @pytest.mark.parametrize("chunk", [False, True]) 2487s def test_save_emptydim(self, chunk) -> None: 2487s if chunk and not has_dask: 2487s pytest.skip("requires dask") 2487s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 2487s if chunk: 2487s ds = ds.chunk({}) # chunk dataset to save dask array 2487s > with self.roundtrip(ds) as ds_reload: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ___ TestZarrDirectoryStore.test_no_warning_from_open_emptydim_with_chunks[3] ___ 2487s 2487s self = 2487s 2487s @requires_dask 2487s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 2487s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 2487s with assert_no_warnings(): 2487s with warnings.catch_warnings(): 2487s warnings.filterwarnings( 2487s "ignore", 2487s message=".*Zarr format 3 specification.*", 2487s category=UserWarning, 2487s ) 2487s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2487s with self.open(store_target, **open_kwargs) as ds: 2487s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2487s return next(self.gen) 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2487s with xr.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'x' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _____ TestZarrDirectoryStore.test_write_region[3-False-False-False-False] ______ 2487s 2487s self = 2487s consolidated = False, compute = False, use_dask = False, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-True] ______ 2487s 2487s self = 2487s consolidated = True, compute = False, use_dask = False, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-None] ______ 2487s 2487s self = 2487s consolidated = None, compute = False, use_dask = False, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-False] ______ 2487s 2487s self = 2487s consolidated = False, compute = True, use_dask = False, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-True] _______ 2487s 2487s self = 2487s consolidated = True, compute = True, use_dask = False, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-None] _______ 2487s 2487s self = 2487s consolidated = None, compute = True, use_dask = False, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-False] ______ 2487s 2487s self = 2487s consolidated = False, compute = False, use_dask = True, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-True] _______ 2487s 2487s self = 2487s consolidated = True, compute = False, use_dask = True, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-None] _______ 2487s 2487s self = 2487s consolidated = None, compute = False, use_dask = True, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s assert_identical(actual, zeros) 2487s for i in range(0, 10, 2): 2487s region = {"x": slice(i, i + 2)} 2487s > nonzeros.isel(region).to_zarr( 2487s store, 2487s region=region, 2487s consolidated=consolidated, 2487s write_empty_chunks=write_empty, 2487s **self.version_kwargs, 2487s ) 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2487s return to_zarr( # type: ignore[call-overload,misc] 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2487s dump_to_store(dataset, zstore, writer, encoding=encoding) 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2487s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2487s k: self.open_store_variable(name=k) for k in existing_variable_names 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s ______ TestZarrDirectoryStore.test_write_region[3-False-True-True-False] _______ 2487s 2487s self = 2487s consolidated = False, compute = True, use_dask = True, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-True] _______ 2487s 2487s self = 2487s consolidated = True, compute = True, use_dask = True, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2487s @pytest.mark.parametrize("use_dask", [False, True]) 2487s @pytest.mark.parametrize("write_empty", [False, True, None]) 2487s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2487s if (use_dask or not compute) and not has_dask: 2487s pytest.skip("requires dask") 2487s 2487s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2487s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2487s 2487s if use_dask: 2487s zeros = zeros.chunk(2) 2487s nonzeros = nonzeros.chunk(2) 2487s 2487s with self.create_zarr_target() as store: 2487s zeros.to_zarr( 2487s store, 2487s consolidated=consolidated, 2487s compute=compute, 2487s encoding={"u": dict(chunks=2)}, 2487s **self.version_kwargs, 2487s ) 2487s if compute: 2487s > with xr.open_zarr( 2487s store, consolidated=consolidated, **self.version_kwargs 2487s ) as actual: 2487s 2487s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2487s ds = open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2487s backend_ds = backend.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2487s ds = store_entrypoint.open_dataset( 2487s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2487s vars, attrs = filename_or_obj.load() 2487s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2487s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2487s return Frozen(dict(*args, **kwargs)) 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2487s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2487s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2487s 2487s self = , name = 'u' 2487s 2487s def open_store_variable(self, name): 2487s zarr_array = self.members[name] 2487s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2487s try_nczarr = self._mode == "r" 2487s dimensions, attributes = _get_zarr_dims_and_attrs( 2487s zarr_array, DIMENSION_KEY, try_nczarr 2487s ) 2487s attributes = dict(attributes) 2487s 2487s encoding = { 2487s "chunks": zarr_array.chunks, 2487s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2487s } 2487s 2487s if _zarr_v3(): 2487s encoding.update( 2487s { 2487s "compressors": zarr_array.compressors, 2487s "filters": zarr_array.filters, 2487s "shards": zarr_array.shards, 2487s } 2487s ) 2487s if self.zarr_group.metadata.zarr_format == 3: 2487s encoding.update({"serializer": zarr_array.serializer}) 2487s else: 2487s encoding.update( 2487s { 2487s "compressor": zarr_array.compressor, 2487s "filters": zarr_array.filters, 2487s } 2487s ) 2487s 2487s if self._use_zarr_fill_value_as_mask: 2487s # Setting this attribute triggers CF decoding for missing values 2487s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2487s if zarr_array.fill_value is not None: 2487s attributes["_FillValue"] = zarr_array.fill_value 2487s elif "_FillValue" in attributes: 2487s original_zarr_dtype = zarr_array.metadata.data_type 2487s attributes["_FillValue"] = FillValueCoder.decode( 2487s > attributes["_FillValue"], original_zarr_dtype.value 2487s ) 2487s E AttributeError: 'Float64' object has no attribute 'value' 2487s 2487s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2487s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-None] _______ 2487s 2487s self = 2487s consolidated = None, compute = True, use_dask = True, write_empty = False 2487s 2487s @pytest.mark.parametrize("consolidated", [False, True, None]) 2487s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-False] ______ 2488s 2488s self = 2488s consolidated = False, compute = False, use_dask = False, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-True] _______ 2488s 2488s self = 2488s consolidated = True, compute = False, use_dask = False, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-None] _______ 2488s 2488s self = 2488s consolidated = None, compute = False, use_dask = False, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-True-False-True-False] _______ 2488s 2488s self = 2488s consolidated = False, compute = True, use_dask = False, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-True] _______ 2488s 2488s self = 2488s consolidated = True, compute = True, use_dask = False, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-None] _______ 2488s 2488s self = 2488s consolidated = None, compute = True, use_dask = False, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-True-True-False-False] _______ 2488s 2488s self = 2488s consolidated = False, compute = False, use_dask = True, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-True] _______ 2488s 2488s self = 2488s consolidated = True, compute = False, use_dask = True, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-None] _______ 2488s 2488s self = 2488s consolidated = None, compute = False, use_dask = True, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-False] _______ 2488s 2488s self = 2488s consolidated = False, compute = True, use_dask = True, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-True] ________ 2488s 2488s self = 2488s consolidated = True, compute = True, use_dask = True, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-None] ________ 2488s 2488s self = 2488s consolidated = None, compute = True, use_dask = True, write_empty = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-False] ______ 2488s 2488s self = 2488s consolidated = False, compute = False, use_dask = False, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-True] _______ 2488s 2488s self = 2488s consolidated = True, compute = False, use_dask = False, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-None] _______ 2488s 2488s self = 2488s consolidated = None, compute = False, use_dask = False, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-None-False-True-False] _______ 2488s 2488s self = 2488s consolidated = False, compute = True, use_dask = False, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-True] _______ 2488s 2488s self = 2488s consolidated = True, compute = True, use_dask = False, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-None] _______ 2488s 2488s self = 2488s consolidated = None, compute = True, use_dask = False, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_region[3-None-True-False-False] _______ 2488s 2488s self = 2488s consolidated = False, compute = False, use_dask = True, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-True] _______ 2488s 2488s self = 2488s consolidated = True, compute = False, use_dask = True, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-None] _______ 2488s 2488s self = 2488s consolidated = None, compute = False, use_dask = True, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s assert_identical(actual, zeros) 2488s for i in range(0, 10, 2): 2488s region = {"x": slice(i, i + 2)} 2488s > nonzeros.isel(region).to_zarr( 2488s store, 2488s region=region, 2488s consolidated=consolidated, 2488s write_empty_chunks=write_empty, 2488s **self.version_kwargs, 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-False] _______ 2488s 2488s self = 2488s consolidated = False, compute = True, use_dask = True, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-True] ________ 2488s 2488s self = 2488s consolidated = True, compute = True, use_dask = True, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-None] ________ 2488s 2488s self = 2488s consolidated = None, compute = True, use_dask = True, write_empty = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s @pytest.mark.parametrize("compute", [False, True]) 2488s @pytest.mark.parametrize("use_dask", [False, True]) 2488s @pytest.mark.parametrize("write_empty", [False, True, None]) 2488s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2488s if (use_dask or not compute) and not has_dask: 2488s pytest.skip("requires dask") 2488s 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s 2488s if use_dask: 2488s zeros = zeros.chunk(2) 2488s nonzeros = nonzeros.chunk(2) 2488s 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr( 2488s store, 2488s consolidated=consolidated, 2488s compute=compute, 2488s encoding={"u": dict(chunks=2)}, 2488s **self.version_kwargs, 2488s ) 2488s if compute: 2488s > with xr.open_zarr( 2488s store, consolidated=consolidated, **self.version_kwargs 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________ TestZarrDirectoryStore.test_write_region_mode[3-None] _____________ 2488s 2488s self = 2488s mode = None 2488s 2488s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2488s def test_write_region_mode(self, mode) -> None: 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr(store, **self.version_kwargs) 2488s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2488s > nonzeros.isel(region).to_zarr( 2488s store, region=region, mode=mode, **self.version_kwargs 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _____________ TestZarrDirectoryStore.test_write_region_mode[3-r+] ______________ 2488s 2488s self = 2488s mode = 'r+' 2488s 2488s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2488s def test_write_region_mode(self, mode) -> None: 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr(store, **self.version_kwargs) 2488s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2488s > nonzeros.isel(region).to_zarr( 2488s store, region=region, mode=mode, **self.version_kwargs 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________ TestZarrDirectoryStore.test_write_region_mode[3-a] ______________ 2488s 2488s self = 2488s mode = 'a' 2488s 2488s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2488s def test_write_region_mode(self, mode) -> None: 2488s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2488s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2488s with self.create_zarr_target() as store: 2488s zeros.to_zarr(store, **self.version_kwargs) 2488s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2488s > nonzeros.isel(region).to_zarr( 2488s store, region=region, mode=mode, **self.version_kwargs 2488s ) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______ TestZarrDirectoryStore.test_write_preexisting_override_metadata[3] ______ 2488s 2488s self = 2488s 2488s @requires_dask 2488s def test_write_preexisting_override_metadata(self) -> None: 2488s """Metadata should be overridden if mode="a" but not in mode="r+".""" 2488s original = Dataset( 2488s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 2488s attrs={"global": "original"}, 2488s ) 2488s both_modified = Dataset( 2488s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 2488s attrs={"global": "modified"}, 2488s ) 2488s global_modified = Dataset( 2488s {"u": (("x",), np.ones(10), {"variable": "original"})}, 2488s attrs={"global": "modified"}, 2488s ) 2488s only_new_data = Dataset( 2488s {"u": (("x",), np.ones(10), {"variable": "original"})}, 2488s attrs={"global": "original"}, 2488s ) 2488s 2488s with self.create_zarr_target() as store: 2488s original.to_zarr(store, compute=False, **self.version_kwargs) 2488s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'u' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________ TestZarrDirectoryStore.test_encoding_chunksizes[3] ______________ 2488s 2488s self = 2488s 2488s @requires_dask 2488s def test_encoding_chunksizes(self) -> None: 2488s # regression test for GH2278 2488s # see also test_encoding_chunksizes_unlimited 2488s nx, ny, nt = 4, 4, 5 2488s original = xr.Dataset( 2488s {}, 2488s coords={ 2488s "x": np.arange(nx), 2488s "y": np.arange(ny), 2488s "t": np.arange(nt), 2488s }, 2488s ) 2488s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 2488s original = original.chunk({"t": 1, "x": 2, "y": 2}) 2488s 2488s > with self.roundtrip(original) as ds1: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'v' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____ TestZarrDirectoryStore.test_chunk_encoding_with_partial_dask_chunks[3] ____ 2488s 2488s self = 2488s 2488s @requires_dask 2488s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 2488s original = xr.Dataset( 2488s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 2488s ).chunk({"a": 3}) 2488s 2488s > with self.roundtrip( 2488s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 2488s ) as ds1: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _____________ TestZarrDirectoryStore.test_open_zarr_use_cftime[3] ______________ 2488s 2488s self = 2488s 2488s @requires_cftime 2488s def test_open_zarr_use_cftime(self) -> None: 2488s ds = create_test_data() 2488s with self.create_zarr_target() as store_target: 2488s ds.to_zarr(store_target, **self.version_kwargs) 2488s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________ TestZarrDirectoryStore.test_write_read_select_write[3] ____________ 2488s 2488s self = 2488s 2488s def test_write_read_select_write(self) -> None: 2488s # Test for https://github.com/pydata/xarray/issues/4084 2488s ds = create_test_data() 2488s 2488s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 2488s with self.create_zarr_target() as initial_store: 2488s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 2488s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrDirectoryStore.test_attributes[3-obj1] ________________ 2488s 2488s self = 2488s obj = Size: 8B 2488s array(nan) 2488s Attributes: 2488s good: {'key': 'value'} 2488s 2488s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 2488s def test_attributes(self, obj) -> None: 2488s obj = obj.copy() 2488s 2488s obj.attrs["good"] = {"key": "value"} 2488s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 2488s with self.create_zarr_target() as store_target: 2488s ds.to_zarr(store_target, **self.version_kwargs) 2488s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'foo' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] _ 2488s 2488s self = 2488s dtype = 'datetime64[ns]' 2488s 2488s @requires_dask 2488s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 2488s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 2488s # Generalized from @malmans2's test in PR #8253 2488s original = create_test_data().astype(dtype).chunk(1) 2488s > with self.roundtrip( 2488s original, 2488s open_kwargs={ 2488s "chunks": {}, 2488s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 2488s }, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 2488s 2488s self = 2488s dtype = 'timedelta64[ns]' 2488s 2488s @requires_dask 2488s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 2488s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 2488s # Generalized from @malmans2's test in PR #8253 2488s original = create_test_data().astype(dtype).chunk(1) 2488s > with self.roundtrip( 2488s original, 2488s open_kwargs={ 2488s "chunks": {}, 2488s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 2488s }, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _________ TestZarrDirectoryStore.test_zarr_fill_value_setting[3-float] _________ 2488s 2488s self = 2488s dtype = 2488s 2488s @requires_dask 2488s @pytest.mark.parametrize("dtype", [int, float]) 2488s def test_zarr_fill_value_setting(self, dtype): 2488s # When zarr_format=2, _FillValue sets fill_value 2488s # When zarr_format=3, fill_value is set independently 2488s # We test this by writing a dask array with compute=False, 2488s # on read we should receive chunks filled with `fill_value` 2488s fv = -1 2488s ds = xr.Dataset( 2488s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 2488s ) 2488s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 2488s 2488s zarr_format_2 = ( 2488s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 2488s ) or not has_zarr_v3 2488s if zarr_format_2: 2488s attr = "_FillValue" 2488s expected.foo.attrs[attr] = fv 2488s else: 2488s attr = "fill_value" 2488s if dtype is float: 2488s # for floats, Xarray inserts a default `np.nan` 2488s expected.foo.attrs["_FillValue"] = np.nan 2488s 2488s # turn off all decoding so we see what Zarr returns to us. 2488s # Since chunks, are not written, we should receive on `fill_value` 2488s open_kwargs = { 2488s "mask_and_scale": False, 2488s "consolidated": False, 2488s "use_zarr_fill_value_as_mask": False, 2488s } 2488s save_kwargs = dict(compute=False, consolidated=False) 2488s > with self.roundtrip( 2488s ds, 2488s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 2488s open_kwargs=open_kwargs, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'foo' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _____________ TestZarrWriteEmpty.test_zero_dimensional_variable[3] _____________ 2488s 2488s self = 2488s 2488s def test_zero_dimensional_variable(self) -> None: 2488s expected = create_test_data() 2488s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 2488s expected["bytes_var"] = ([], b"foobar") 2488s expected["string_var"] = ([], "foobar") 2488s > with self.roundtrip(expected) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________________ TestZarrWriteEmpty.test_write_store[3] ____________________ 2488s 2488s self = 2488s 2488s def test_write_store(self) -> None: 2488s expected = create_test_data() 2488s with self.create_store() as store: 2488s expected.dump_to_store(store) 2488s # we need to cf decode the store because it has time and 2488s # non-dimension coordinates 2488s > with xr.decode_cf(store) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 2488s vars, attrs = obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_roundtrip_test_data[3] ________________ 2488s 2488s self = 2488s 2488s def test_roundtrip_test_data(self) -> None: 2488s expected = create_test_data() 2488s > with self.roundtrip(expected) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______________________ TestZarrWriteEmpty.test_load[3] ________________________ 2488s 2488s self = 2488s 2488s def test_load(self) -> None: 2488s expected = create_test_data() 2488s 2488s @contextlib.contextmanager 2488s def assert_loads(vars=None): 2488s if vars is None: 2488s vars = expected 2488s with self.roundtrip(expected) as actual: 2488s for k, v in actual.variables.items(): 2488s # IndexVariables are eagerly loaded into memory 2488s assert v._in_memory == (k in actual.dims) 2488s yield actual 2488s for k, v in actual.variables.items(): 2488s if k in vars: 2488s assert v._in_memory 2488s assert_identical(expected, actual) 2488s 2488s with pytest.raises(AssertionError): 2488s # make sure the contextmanager works! 2488s > with assert_loads() as ds: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 2488s with self.roundtrip(expected) as actual: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s __________________ TestZarrWriteEmpty.test_dataset_compute[3] __________________ 2488s 2488s self = 2488s 2488s def test_dataset_compute(self) -> None: 2488s expected = create_test_data() 2488s 2488s > with self.roundtrip(expected) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________ TestZarrWriteEmpty.test_roundtrip_object_dtype[3] _______________ 2488s 2488s self = 2488s 2488s def test_roundtrip_object_dtype(self) -> None: 2488s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 2488s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 2488s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 2488s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 2488s strings = np.array(["ab", "cdef", "g"], dtype=object) 2488s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 2488s all_nans = np.array([np.nan, np.nan], dtype=object) 2488s original = Dataset( 2488s { 2488s "floats": ("a", floats), 2488s "floats_nans": ("a", floats_nans), 2488s "bytes": ("b", bytes_), 2488s "bytes_nans": ("b", bytes_nans), 2488s "strings": ("b", strings), 2488s "strings_nans": ("b", strings_nans), 2488s "all_nans": ("c", all_nans), 2488s "nan": ([], np.nan), 2488s } 2488s ) 2488s expected = original.copy(deep=True) 2488s > with self.roundtrip(original) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'nan' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________ TestZarrWriteEmpty.test_roundtrip_float64_data[3] _______________ 2488s 2488s self = 2488s 2488s def test_roundtrip_float64_data(self) -> None: 2488s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 2488s > with self.roundtrip(expected) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_orthogonal_indexing[3] ________________ 2488s 2488s self = 2488s 2488s def test_orthogonal_indexing(self) -> None: 2488s in_memory = create_test_data() 2488s > with self.roundtrip(in_memory) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_vectorized_indexing[3] ________________ 2488s 2488s self = 2488s 2488s def test_vectorized_indexing(self) -> None: 2488s in_memory = create_test_data() 2488s > with self.roundtrip(in_memory) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _________ TestZarrWriteEmpty.test_vectorized_indexing_negative_step[3] _________ 2488s 2488s self = 2488s 2488s def test_vectorized_indexing_negative_step(self) -> None: 2488s # use dask explicitly when present 2488s open_kwargs: dict[str, Any] | None 2488s if has_dask: 2488s open_kwargs = {"chunks": {}} 2488s else: 2488s open_kwargs = None 2488s in_memory = create_test_data() 2488s 2488s def multiple_indexing(indexers): 2488s # make sure a sequence of lazy indexings certainly works. 2488s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 2488s actual = on_disk["var3"] 2488s expected = in_memory["var3"] 2488s for ind in indexers: 2488s actual = actual.isel(ind) 2488s expected = expected.isel(ind) 2488s # make sure the array is not yet loaded into memory 2488s assert not actual.variable._in_memory 2488s assert_identical(expected, actual.load()) 2488s 2488s # with negative step slice. 2488s indexers = [ 2488s { 2488s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 2488s "dim3": slice(-1, 1, -1), 2488s } 2488s ] 2488s > multiple_indexing(indexers) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 2488s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________ TestZarrWriteEmpty.test_outer_indexing_reversed[3] ______________ 2488s 2488s self = 2488s 2488s def test_outer_indexing_reversed(self) -> None: 2488s # regression test for GH6560 2488s ds = xr.Dataset( 2488s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 2488s ) 2488s 2488s > with self.roundtrip(ds) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'z' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s __________________ TestZarrWriteEmpty.test_isel_dataarray[3] ___________________ 2488s 2488s self = 2488s 2488s def test_isel_dataarray(self) -> None: 2488s # Make sure isel works lazily. GH:issue:1688 2488s in_memory = create_test_data() 2488s > with self.roundtrip(in_memory) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _____________ TestZarrWriteEmpty.test_array_type_after_indexing[3] _____________ 2488s 2488s self = 2488s 2488s def test_array_type_after_indexing(self) -> None: 2488s in_memory = create_test_data() 2488s > with self.roundtrip(in_memory) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________________ TestZarrWriteEmpty.test_dropna[3] _______________________ 2488s 2488s self = 2488s 2488s def test_dropna(self) -> None: 2488s # regression test for GH:issue:1694 2488s a = np.random.randn(4, 3) 2488s a[1, 1] = np.nan 2488s in_memory = xr.Dataset( 2488s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 2488s ) 2488s 2488s assert_identical( 2488s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 2488s ) 2488s 2488s > with self.roundtrip(in_memory) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'a' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_ondisk_after_print[3] _________________ 2488s 2488s self = 2488s 2488s def test_ondisk_after_print(self) -> None: 2488s """Make sure print does not load file into memory""" 2488s in_memory = create_test_data() 2488s > with self.roundtrip(in_memory) as on_disk: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s __________ TestZarrWriteEmpty.test_roundtrip_bytes_with_fill_value[3] __________ 2488s 2488s self = 2488s 2488s def test_roundtrip_bytes_with_fill_value(self) -> None: 2488s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 2488s encoding = {"_FillValue": b"X", "dtype": "S1"} 2488s original = Dataset({"x": ("t", values, {}, encoding)}) 2488s expected = original.copy(deep=True) 2488s > with self.roundtrip(original) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value0-False] ________ 2488s 2488s self = 2488s fill_value = np.int8(-1), exp_fill_warning = False 2488s 2488s @pytest.mark.parametrize( 2488s ("fill_value", "exp_fill_warning"), 2488s [ 2488s (np.int8(-1), False), 2488s (np.uint8(255), True), 2488s (-1, False), 2488s (255, True), 2488s ], 2488s ) 2488s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2488s @contextlib.contextmanager 2488s def _roundtrip_with_warnings(*args, **kwargs): 2488s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2488s if exp_fill_warning and is_np2: 2488s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2488s SerializationWarning, 2488s match="_FillValue attribute can't be represented", 2488s ) 2488s else: 2488s warn_checker = contextlib.nullcontext() 2488s with warn_checker: 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s yield actual 2488s 2488s # regression/numpy2 test for 2488s encoding = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s "dtype": "i1", 2488s } 2488s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2488s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2488s 2488s attributes = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s } 2488s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2488s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2488s encoded = Dataset({"x": ("t", sb, attributes)}) 2488s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2488s 2488s > with _roundtrip_with_warnings(decoded) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Int8' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value1-True] ________ 2488s 2488s self = 2488s fill_value = np.uint8(255), exp_fill_warning = True 2488s 2488s @pytest.mark.parametrize( 2488s ("fill_value", "exp_fill_warning"), 2488s [ 2488s (np.int8(-1), False), 2488s (np.uint8(255), True), 2488s (-1, False), 2488s (255, True), 2488s ], 2488s ) 2488s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2488s @contextlib.contextmanager 2488s def _roundtrip_with_warnings(*args, **kwargs): 2488s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2488s if exp_fill_warning and is_np2: 2488s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2488s SerializationWarning, 2488s match="_FillValue attribute can't be represented", 2488s ) 2488s else: 2488s warn_checker = contextlib.nullcontext() 2488s with warn_checker: 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s yield actual 2488s 2488s # regression/numpy2 test for 2488s encoding = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s "dtype": "i1", 2488s } 2488s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2488s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2488s 2488s attributes = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s } 2488s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2488s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2488s encoded = Dataset({"x": ("t", sb, attributes)}) 2488s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2488s 2488s > with _roundtrip_with_warnings(decoded) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Int8' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3--1-False] ____________ 2488s 2488s self = 2488s fill_value = -1, exp_fill_warning = False 2488s 2488s @pytest.mark.parametrize( 2488s ("fill_value", "exp_fill_warning"), 2488s [ 2488s (np.int8(-1), False), 2488s (np.uint8(255), True), 2488s (-1, False), 2488s (255, True), 2488s ], 2488s ) 2488s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2488s @contextlib.contextmanager 2488s def _roundtrip_with_warnings(*args, **kwargs): 2488s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2488s if exp_fill_warning and is_np2: 2488s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2488s SerializationWarning, 2488s match="_FillValue attribute can't be represented", 2488s ) 2488s else: 2488s warn_checker = contextlib.nullcontext() 2488s with warn_checker: 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s yield actual 2488s 2488s # regression/numpy2 test for 2488s encoding = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s "dtype": "i1", 2488s } 2488s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2488s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2488s 2488s attributes = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s } 2488s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2488s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2488s encoded = Dataset({"x": ("t", sb, attributes)}) 2488s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2488s 2488s > with _roundtrip_with_warnings(decoded) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Int8' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-255-True] ____________ 2488s 2488s self = 2488s fill_value = 255, exp_fill_warning = True 2488s 2488s @pytest.mark.parametrize( 2488s ("fill_value", "exp_fill_warning"), 2488s [ 2488s (np.int8(-1), False), 2488s (np.uint8(255), True), 2488s (-1, False), 2488s (255, True), 2488s ], 2488s ) 2488s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 2488s @contextlib.contextmanager 2488s def _roundtrip_with_warnings(*args, **kwargs): 2488s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 2488s if exp_fill_warning and is_np2: 2488s warn_checker: contextlib.AbstractContextManager = pytest.warns( 2488s SerializationWarning, 2488s match="_FillValue attribute can't be represented", 2488s ) 2488s else: 2488s warn_checker = contextlib.nullcontext() 2488s with warn_checker: 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s yield actual 2488s 2488s # regression/numpy2 test for 2488s encoding = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s "dtype": "i1", 2488s } 2488s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 2488s decoded = Dataset({"x": ("t", x, {}, encoding)}) 2488s 2488s attributes = { 2488s "_FillValue": fill_value, 2488s "_Unsigned": "true", 2488s } 2488s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 2488s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 2488s encoded = Dataset({"x": ("t", sb, attributes)}) 2488s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 2488s 2488s > with _roundtrip_with_warnings(decoded) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 2488s with self.roundtrip(*args, **kwargs) as actual: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Int8' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 2488s 2488s self = 2488s 2488s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 2488s original = self._create_cf_dataset() 2488s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'det_lim' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ___ TestZarrWriteEmpty.test_coordinate_variables_after_dataset_roundtrip[3] ____ 2488s 2488s self = 2488s 2488s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 2488s original = self._create_cf_dataset() 2488s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'det_lim' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 2488s 2488s self = 2488s 2488s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 2488s self, 2488s ) -> None: 2488s original = self._create_cf_dataset() 2488s # The DataArray roundtrip should have the same warnings as the 2488s # Dataset, but we already tested for those, so just go for the 2488s # new warnings. It would appear that there is no way to tell 2488s # pytest "This warning and also this warning should both be 2488s # present". 2488s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 2488s # needs the to_dataset. The other backends should be fine 2488s # without it. 2488s with pytest.warns( 2488s UserWarning, 2488s match=( 2488s r"Variable\(s\) referenced in bounds not in variables: " 2488s r"\['l(at|ong)itude_bnds'\]" 2488s ), 2488s ): 2488s > with self.roundtrip( 2488s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'ln_p' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s 2488s During handling of the above exception, another exception occurred: 2488s 2488s self = 2488s 2488s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 2488s self, 2488s ) -> None: 2488s original = self._create_cf_dataset() 2488s # The DataArray roundtrip should have the same warnings as the 2488s # Dataset, but we already tested for those, so just go for the 2488s # new warnings. It would appear that there is no way to tell 2488s # pytest "This warning and also this warning should both be 2488s # present". 2488s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 2488s # needs the to_dataset. The other backends should be fine 2488s # without it. 2488s > with pytest.warns( 2488s UserWarning, 2488s match=( 2488s r"Variable\(s\) referenced in bounds not in variables: " 2488s r"\['l(at|ong)itude_bnds'\]" 2488s ), 2488s ): 2488s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 2488s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 2488s 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.')]. 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 2488s __________________ TestZarrWriteEmpty.test_encoding_kwarg[3] ___________________ 2488s 2488s self = 2488s 2488s def test_encoding_kwarg(self) -> None: 2488s ds = Dataset({"x": ("y", np.arange(10.0))}) 2488s 2488s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 2488s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float32' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_default_fill_value[3] _________________ 2488s 2488s self = 2488s 2488s def test_default_fill_value(self) -> None: 2488s # Test default encoding for float: 2488s ds = Dataset({"x": ("y", np.arange(10.0))}) 2488s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 2488s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float32' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord[3] ________ 2488s 2488s self = 2488s 2488s def test_explicitly_omit_fill_value_in_coord(self) -> None: 2488s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 2488s ds.y.encoding["_FillValue"] = None 2488s > with self.roundtrip(ds) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 2488s 2488s self = 2488s 2488s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 2488s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 2488s kwargs = dict(encoding={"y": {"_FillValue": None}}) 2488s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_encoding_same_dtype[3] ________________ 2488s 2488s self = 2488s 2488s def test_encoding_same_dtype(self) -> None: 2488s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 2488s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 2488s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'x' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float32' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ______________ TestZarrWriteEmpty.test_append_overwrite_values[3] ______________ 2488s 2488s self = 2488s 2488s def test_append_overwrite_values(self) -> None: 2488s # regression for GH1215 2488s data = create_test_data() 2488s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 2488s self.save(data, tmp_file, mode="w") 2488s data["var2"][:] = -999 2488s data["var9"] = data["var2"] * 3 2488s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 2488s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ___________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-False] ____________ 2488s 2488s self = 2488s consolidated = False 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s def test_roundtrip_consolidated(self, consolidated) -> None: 2488s expected = create_test_data() 2488s > with self.roundtrip( 2488s expected, 2488s save_kwargs={"consolidated": consolidated}, 2488s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'var3' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-True] ____________ 2488s 2488s self = 2488s consolidated = True 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s def test_roundtrip_consolidated(self, consolidated) -> None: 2488s expected = create_test_data() 2488s > with self.roundtrip( 2488s expected, 2488s save_kwargs={"consolidated": consolidated}, 2488s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-None] ____________ 2488s 2488s self = 2488s consolidated = None 2488s 2488s @pytest.mark.parametrize("consolidated", [False, True, None]) 2488s def test_roundtrip_consolidated(self, consolidated) -> None: 2488s expected = create_test_data() 2488s > with self.roundtrip( 2488s expected, 2488s save_kwargs={"consolidated": consolidated}, 2488s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ___________ TestZarrWriteEmpty.test_read_non_consolidated_warning[3] ___________ 2488s 2488s self = 2488s 2488s def test_read_non_consolidated_warning(self) -> None: 2488s expected = create_test_data() 2488s with self.create_zarr_target() as store: 2488s self.save( 2488s expected, store_target=store, consolidated=False, **self.version_kwargs 2488s ) 2488s with pytest.warns( 2488s RuntimeWarning, 2488s match="Failed to open Zarr store with consolidated", 2488s ): 2488s > with xr.open_zarr(store, **self.version_kwargs) as ds: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_non_existent_store[3] _________________ 2488s 2488s self = 2488s 2488s def test_non_existent_store(self) -> None: 2488s with pytest.raises( 2488s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2488s ): 2488s > xr.open_zarr(f"{uuid.uuid4()}") 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2488s ds = open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 2488s store = ZarrStore.open_group( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 2488s ) = _get_open_params( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 2488s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 2488s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 2488s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 2488s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2488s raise return_result 2488s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2488s return await coro 2488s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 2488s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 2488s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2488s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2488s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 2488s store = await make_store(store_like, mode=mode, storage_options=storage_options) 2488s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 2488s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 2488s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 2488s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 2488s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 2488s await store._open() 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = LocalStore('file:///tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/efbac25e-4dbc-4048-ab91-172fdae95d73') 2488s 2488s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 2488s if not self.read_only: 2488s self.root.mkdir(parents=True, exist_ok=True) 2488s 2488s if not self.root.exists(): 2488s > raise FileNotFoundError(f"{self.root} does not exist") 2488s E FileNotFoundError: /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/efbac25e-4dbc-4048-ab91-172fdae95d73 does not exist 2488s 2488s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 2488s 2488s During handling of the above exception, another exception occurred: 2488s 2488s self = 2488s 2488s def test_non_existent_store(self) -> None: 2488s > with pytest.raises( 2488s FileNotFoundError, match="(No such file or directory|Unable to find group)" 2488s ): 2488s E AssertionError: Regex pattern did not match. 2488s E Regex: '(No such file or directory|Unable to find group)' 2488s E Input: '/tmp/autopkgtest.VI88X3/autopkgtest_tmp/build/efbac25e-4dbc-4048-ab91-172fdae95d73 does not exist' 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 2488s ____________________ TestZarrWriteEmpty.test_auto_chunk[3] _____________________ 2488s 2488s self = 2488s 2488s @requires_dask 2488s def test_auto_chunk(self) -> None: 2488s original = create_test_data().chunk() 2488s 2488s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ___________________ TestZarrWriteEmpty.test_manual_chunk[3] ____________________ 2488s 2488s self = 2488s 2488s @requires_dask 2488s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 2488s def test_manual_chunk(self) -> None: 2488s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 2488s 2488s # Using chunks = None should return non-chunked arrays 2488s open_kwargs: dict[str, Any] = {"chunks": None} 2488s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______________ TestZarrWriteEmpty.test_warning_on_bad_chunks[3] _______________ 2488s 2488s self = 2488s 2488s @requires_dask 2488s def test_warning_on_bad_chunks(self) -> None: 2488s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 2488s 2488s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 2488s for chunks in bad_chunks: 2488s kwargs = {"chunks": chunks} 2488s with pytest.warns(UserWarning): 2488s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _____________ TestZarrWriteEmpty.test_write_uneven_dask_chunks[3] ______________ 2488s 2488s self = 2488s 2488s @requires_dask 2488s def test_write_uneven_dask_chunks(self) -> None: 2488s # regression for GH#2225 2488s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 2488s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s __________________ TestZarrWriteEmpty.test_chunk_encoding[3] ___________________ 2488s 2488s self = 2488s 2488s def test_chunk_encoding(self) -> None: 2488s # These datasets have no dask chunks. All chunking specified in 2488s # encoding 2488s data = create_test_data() 2488s chunks = (5, 5) 2488s data["var2"].encoding.update({"chunks": chunks}) 2488s 2488s > with self.roundtrip(data) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s __________________ TestZarrWriteEmpty.test_shard_encoding[3] ___________________ 2488s 2488s self = 2488s 2488s def test_shard_encoding(self) -> None: 2488s # These datasets have no dask chunks. All chunking/sharding specified in 2488s # encoding 2488s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2488s data = create_test_data() 2488s chunks = (1, 1) 2488s shards = (5, 5) 2488s data["var2"].encoding.update({"chunks": chunks}) 2488s data["var2"].encoding.update({"shards": shards}) 2488s > with self.roundtrip(data) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ___________ TestZarrWriteEmpty.test_write_persistence_modes[3-None] ____________ 2488s 2488s self = 2488s group = None 2488s 2488s @pytest.mark.parametrize("group", [None, "group1"]) 2488s def test_write_persistence_modes(self, group) -> None: 2488s original = create_test_data() 2488s 2488s # overwrite mode 2488s > with self.roundtrip( 2488s original, 2488s save_kwargs={"mode": "w", "group": group}, 2488s open_kwargs={"group": group}, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s __________ TestZarrWriteEmpty.test_write_persistence_modes[3-group1] ___________ 2488s 2488s self = 2488s group = 'group1' 2488s 2488s @pytest.mark.parametrize("group", [None, "group1"]) 2488s def test_write_persistence_modes(self, group) -> None: 2488s original = create_test_data() 2488s 2488s # overwrite mode 2488s > with self.roundtrip( 2488s original, 2488s save_kwargs={"mode": "w", "group": group}, 2488s open_kwargs={"group": group}, 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ________________ TestZarrWriteEmpty.test_compressor_encoding[3] ________________ 2488s 2488s self = 2488s 2488s def test_compressor_encoding(self) -> None: 2488s # specify a custom compressor 2488s original = create_test_data() 2488s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2488s encoding_key = "compressors" 2488s # all parameters need to be explicitly specified in order for the comparison to pass below 2488s encoding = { 2488s "serializer": zarr.codecs.BytesCodec(endian="little"), 2488s encoding_key: ( 2488s zarr.codecs.BloscCodec( 2488s cname="zstd", 2488s clevel=3, 2488s shuffle="shuffle", 2488s typesize=8, 2488s blocksize=0, 2488s ), 2488s ), 2488s } 2488s else: 2488s from numcodecs.blosc import Blosc 2488s 2488s encoding_key = "compressors" if has_zarr_v3 else "compressor" 2488s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 2488s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 2488s 2488s save_kwargs = dict(encoding={"var1": encoding}) 2488s 2488s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______________________ TestZarrWriteEmpty.test_group[3] _______________________ 2488s 2488s self = 2488s 2488s def test_group(self) -> None: 2488s original = create_test_data() 2488s group = "some/random/path" 2488s > with self.roundtrip( 2488s original, save_kwargs={"group": group}, open_kwargs={"group": group} 2488s ) as actual: 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2488s with self.open(store_target, **open_kwargs) as ds: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2488s with xr.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2488s backend_ds = backend.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2488s ds = store_entrypoint.open_dataset( 2488s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2488s vars, attrs = filename_or_obj.load() 2488s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2488s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2488s return Frozen(dict(*args, **kwargs)) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2488s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s ___________________ TestZarrWriteEmpty.test_append_write[3] ____________________ 2488s 2488s self = 2488s 2488s def test_append_write(self) -> None: 2488s > super().test_append_write() 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 2488s with self.roundtrip_append(data) as actual: 2488s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2488s return next(self.gen) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 2488s self.save(data[[key]], path, mode=mode, **save_kwargs) 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 2488s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'dim2' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrWriteEmpty.test_append_with_append_dim_not_set_raises[3] _______ 2488s 2488s self = 2488s 2488s def test_append_with_append_dim_not_set_raises(self) -> None: 2488s ds, ds_to_append, _ = create_append_test_data() 2488s with self.create_zarr_target() as store_target: 2488s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2488s with pytest.raises(ValueError, match="different dimension sizes"): 2488s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2488s k: self.open_store_variable(name=k) for k in existing_variable_names 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s self = , name = 'da' 2488s 2488s def open_store_variable(self, name): 2488s zarr_array = self.members[name] 2488s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2488s try_nczarr = self._mode == "r" 2488s dimensions, attributes = _get_zarr_dims_and_attrs( 2488s zarr_array, DIMENSION_KEY, try_nczarr 2488s ) 2488s attributes = dict(attributes) 2488s 2488s encoding = { 2488s "chunks": zarr_array.chunks, 2488s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2488s } 2488s 2488s if _zarr_v3(): 2488s encoding.update( 2488s { 2488s "compressors": zarr_array.compressors, 2488s "filters": zarr_array.filters, 2488s "shards": zarr_array.shards, 2488s } 2488s ) 2488s if self.zarr_group.metadata.zarr_format == 3: 2488s encoding.update({"serializer": zarr_array.serializer}) 2488s else: 2488s encoding.update( 2488s { 2488s "compressor": zarr_array.compressor, 2488s "filters": zarr_array.filters, 2488s } 2488s ) 2488s 2488s if self._use_zarr_fill_value_as_mask: 2488s # Setting this attribute triggers CF decoding for missing values 2488s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2488s if zarr_array.fill_value is not None: 2488s attributes["_FillValue"] = zarr_array.fill_value 2488s elif "_FillValue" in attributes: 2488s original_zarr_dtype = zarr_array.metadata.data_type 2488s attributes["_FillValue"] = FillValueCoder.decode( 2488s > attributes["_FillValue"], original_zarr_dtype.value 2488s ) 2488s E AttributeError: 'Float64' object has no attribute 'value' 2488s 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2488s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-U] _______ 2488s 2488s self = 2488s dtype = 'U' 2488s 2488s @pytest.mark.parametrize("dtype", ["U", "S"]) 2488s def test_append_string_length_mismatch_works(self, dtype) -> None: 2488s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 2488s # ...but it probably would if we used object dtype 2488s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 2488s expected = xr.concat([ds, ds_to_append], dim="time") 2488s with self.create_zarr_target() as store_target: 2488s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2488s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 2488s _validate_datatypes_for_zarr_append( 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s vname = 'temperature' 2488s existing_var = Size: 24B 2488s [3 values with dtype= Size: 60B 2488s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 2488s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 2488s f"and dataset to append. Store has dtype {existing_var.dtype} but " 2488s f"dataset to append has dtype {new_var.dtype}." 2488s ) 2488s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 2488s dtype = 'S' 2488s 2488s @pytest.mark.parametrize("dtype", ["U", "S"]) 2488s def test_append_string_length_mismatch_works(self, dtype) -> None: 2488s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 2488s # ...but it probably would if we used object dtype 2488s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 2488s expected = xr.concat([ds, ds_to_append], dim="time") 2488s with self.create_zarr_target() as store_target: 2488s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2488s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 2488s 2488s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2488s return to_zarr( # type: ignore[call-overload,misc] 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2488s dump_to_store(dataset, zstore, writer, encoding=encoding) 2488s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2488s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2488s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 2488s _validate_datatypes_for_zarr_append( 2488s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2488s 2488s vname = 'temperature' 2488s existing_var = Size: 6B 2488s [3 values with dtype=|S2] 2488s new_var = Size: 9B 2488s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 2488s 2488s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 2488s """If variable exists in the store, confirm dtype of the data to append is compatible with 2488s existing dtype. 2488s """ 2488s if ( 2488s np.issubdtype(new_var.dtype, np.number) 2488s or np.issubdtype(new_var.dtype, np.datetime64) 2488s or np.issubdtype(new_var.dtype, np.bool_) 2488s or new_var.dtype == object 2488s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 2488s ): 2488s # We can skip dtype equality checks under two conditions: (1) if the var to append is 2488s # new to the dataset, because in this case there is no existing var to compare it to; 2488s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 2488s # we can be confident appending won't cause problems. Examples of dtypes which are not 2488s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 2489s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 2489s f"and dataset to append. Store has dtype {existing_var.dtype} but " 2489s f"dataset to append has dtype {new_var.dtype}." 2489s ) 2489s 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. 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 2489s _____ TestZarrWriteEmpty.test_check_encoding_is_consistent_after_append[3] _____ 2489s 2489s self = 2489s 2489s def test_check_encoding_is_consistent_after_append(self) -> None: 2489s ds, ds_to_append, _ = create_append_test_data() 2489s 2489s # check encoding consistency 2489s with self.create_zarr_target() as store_target: 2489s import numcodecs 2489s 2489s encoding_value: Any 2489s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 2489s compressor = zarr.codecs.BloscCodec() 2489s else: 2489s compressor = numcodecs.Blosc() 2489s encoding_key = "compressors" if has_zarr_v3 else "compressor" 2489s encoding_value = (compressor,) if has_zarr_v3 else compressor 2489s 2489s encoding = {"da": {encoding_key: encoding_value}} 2489s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 2489s > original_ds = xr.open_dataset( 2489s store_target, engine="zarr", **self.version_kwargs 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'da' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _____________ TestZarrWriteEmpty.test_append_with_new_variable[3] ______________ 2489s 2489s self = 2489s 2489s def test_append_with_new_variable(self) -> None: 2489s ds, ds_to_append, ds_with_new_var = create_append_test_data() 2489s 2489s # check append mode for new variable 2489s with self.create_zarr_target() as store_target: 2489s combined = xr.concat([ds, ds_to_append], dim="time") 2489s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 2489s assert_identical( 2489s combined, 2489s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'da' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_append_with_append_dim_no_overwrite[3] ________ 2489s 2489s self = 2489s 2489s def test_append_with_append_dim_no_overwrite(self) -> None: 2489s ds, ds_to_append, _ = create_append_test_data() 2489s with self.create_zarr_target() as store_target: 2489s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 2489s original = xr.concat([ds, ds_to_append], dim="time") 2489s original2 = xr.concat([original, ds_to_append], dim="time") 2489s 2489s # overwrite a coordinate; 2489s # for mode='a-', this will not get written to the store 2489s # because it does not have the append_dim as a dim 2489s lon = ds_to_append.lon.to_numpy().copy() 2489s lon[:] = -999 2489s ds_to_append["lon"] = lon 2489s > ds_to_append.to_zarr( 2489s store_target, mode="a-", append_dim="time", **self.version_kwargs 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'da' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s __________ TestZarrWriteEmpty.test_to_zarr_compute_false_roundtrip[3] __________ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_to_zarr_compute_false_roundtrip(self) -> None: 2489s from dask.delayed import Delayed 2489s 2489s original = create_test_data().chunk() 2489s 2489s with self.create_zarr_target() as store: 2489s delayed_obj = self.save(original, store, compute=False) 2489s assert isinstance(delayed_obj, Delayed) 2489s 2489s # make sure target store has not been written to yet 2489s with pytest.raises(AssertionError): 2489s > with self.open(store) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'dim2' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______ TestZarrWriteEmpty.test_to_zarr_append_compute_false_roundtrip[3] _______ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 2489s from dask.delayed import Delayed 2489s 2489s ds, ds_to_append, _ = create_append_test_data() 2489s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 2489s 2489s with pytest.warns(SerializationWarning): 2489s with self.create_zarr_target() as store: 2489s delayed_obj = self.save(ds, store, compute=False, mode="w") 2489s assert isinstance(delayed_obj, Delayed) 2489s 2489s with pytest.raises(AssertionError): 2489s > with self.open(store) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'da' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________________ TestZarrWriteEmpty.test_save_emptydim[3-False] ________________ 2489s 2489s self = 2489s chunk = False 2489s 2489s @pytest.mark.parametrize("chunk", [False, True]) 2489s def test_save_emptydim(self, chunk) -> None: 2489s if chunk and not has_dask: 2489s pytest.skip("requires dask") 2489s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 2489s if chunk: 2489s ds = ds.chunk({}) # chunk dataset to save dask array 2489s > with self.roundtrip(ds) as ds_reload: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'x' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________________ TestZarrWriteEmpty.test_save_emptydim[3-True] _________________ 2489s 2489s self = 2489s chunk = True 2489s 2489s @pytest.mark.parametrize("chunk", [False, True]) 2489s def test_save_emptydim(self, chunk) -> None: 2489s if chunk and not has_dask: 2489s pytest.skip("requires dask") 2489s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 2489s if chunk: 2489s ds = ds.chunk({}) # chunk dataset to save dask array 2489s > with self.roundtrip(ds) as ds_reload: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'x' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _____ TestZarrWriteEmpty.test_no_warning_from_open_emptydim_with_chunks[3] _____ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 2489s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 2489s with assert_no_warnings(): 2489s with warnings.catch_warnings(): 2489s warnings.filterwarnings( 2489s "ignore", 2489s message=".*Zarr format 3 specification.*", 2489s category=UserWarning, 2489s ) 2489s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'x' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______ TestZarrWriteEmpty.test_write_region[3-False-False-False-False] ________ 2489s 2489s self = 2489s consolidated = False, compute = False, use_dask = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-True] ________ 2489s 2489s self = 2489s consolidated = True, compute = False, use_dask = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-None] ________ 2489s 2489s self = 2489s consolidated = None, compute = False, use_dask = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-False] ________ 2489s 2489s self = 2489s consolidated = False, compute = True, use_dask = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = True, use_dask = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = True, use_dask = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-False] ________ 2489s 2489s self = 2489s consolidated = False, compute = False, use_dask = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = False, use_dask = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = False, use_dask = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-False-True-True-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = True, use_dask = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = True, use_dask = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = True, use_dask = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-False] ________ 2489s 2489s self = 2489s consolidated = False, compute = False, use_dask = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = False, use_dask = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = False, use_dask = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-True-False-True-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = True, use_dask = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = True, use_dask = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = True, use_dask = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-True-True-False-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = False, use_dask = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = False, use_dask = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = False, use_dask = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = True, use_dask = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-True] __________ 2489s 2489s self = 2489s consolidated = True, compute = True, use_dask = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-None] __________ 2489s 2489s self = 2489s consolidated = None, compute = True, use_dask = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-False] ________ 2489s 2489s self = 2489s consolidated = False, compute = False, use_dask = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = False, use_dask = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = False, use_dask = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-None-False-True-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = True, use_dask = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = True, use_dask = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = True, use_dask = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_region[3-None-True-False-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = False, use_dask = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-True] _________ 2489s 2489s self = 2489s consolidated = True, compute = False, use_dask = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-None] _________ 2489s 2489s self = 2489s consolidated = None, compute = False, use_dask = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s assert_identical(actual, zeros) 2489s for i in range(0, 10, 2): 2489s region = {"x": slice(i, i + 2)} 2489s > nonzeros.isel(region).to_zarr( 2489s store, 2489s region=region, 2489s consolidated=consolidated, 2489s write_empty_chunks=write_empty, 2489s **self.version_kwargs, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-False] _________ 2489s 2489s self = 2489s consolidated = False, compute = True, use_dask = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-True] __________ 2489s 2489s self = 2489s consolidated = True, compute = True, use_dask = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-None] __________ 2489s 2489s self = 2489s consolidated = None, compute = True, use_dask = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [False, True, None]) 2489s @pytest.mark.parametrize("compute", [False, True]) 2489s @pytest.mark.parametrize("use_dask", [False, True]) 2489s @pytest.mark.parametrize("write_empty", [False, True, None]) 2489s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 2489s if (use_dask or not compute) and not has_dask: 2489s pytest.skip("requires dask") 2489s 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s 2489s if use_dask: 2489s zeros = zeros.chunk(2) 2489s nonzeros = nonzeros.chunk(2) 2489s 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr( 2489s store, 2489s consolidated=consolidated, 2489s compute=compute, 2489s encoding={"u": dict(chunks=2)}, 2489s **self.version_kwargs, 2489s ) 2489s if compute: 2489s > with xr.open_zarr( 2489s store, consolidated=consolidated, **self.version_kwargs 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_region_mode[3-None] _______________ 2489s 2489s self = 2489s mode = None 2489s 2489s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2489s def test_write_region_mode(self, mode) -> None: 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr(store, **self.version_kwargs) 2489s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2489s > nonzeros.isel(region).to_zarr( 2489s store, region=region, mode=mode, **self.version_kwargs 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________ TestZarrWriteEmpty.test_write_region_mode[3-r+] ________________ 2489s 2489s self = 2489s mode = 'r+' 2489s 2489s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2489s def test_write_region_mode(self, mode) -> None: 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr(store, **self.version_kwargs) 2489s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2489s > nonzeros.isel(region).to_zarr( 2489s store, region=region, mode=mode, **self.version_kwargs 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________________ TestZarrWriteEmpty.test_write_region_mode[3-a] ________________ 2489s 2489s self = 2489s mode = 'a' 2489s 2489s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 2489s def test_write_region_mode(self, mode) -> None: 2489s zeros = Dataset({"u": (("x",), np.zeros(10))}) 2489s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 2489s with self.create_zarr_target() as store: 2489s zeros.to_zarr(store, **self.version_kwargs) 2489s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 2489s > nonzeros.isel(region).to_zarr( 2489s store, region=region, mode=mode, **self.version_kwargs 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________ TestZarrWriteEmpty.test_write_preexisting_override_metadata[3] ________ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_write_preexisting_override_metadata(self) -> None: 2489s """Metadata should be overridden if mode="a" but not in mode="r+".""" 2489s original = Dataset( 2489s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 2489s attrs={"global": "original"}, 2489s ) 2489s both_modified = Dataset( 2489s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 2489s attrs={"global": "modified"}, 2489s ) 2489s global_modified = Dataset( 2489s {"u": (("x",), np.ones(10), {"variable": "original"})}, 2489s attrs={"global": "modified"}, 2489s ) 2489s only_new_data = Dataset( 2489s {"u": (("x",), np.ones(10), {"variable": "original"})}, 2489s attrs={"global": "original"}, 2489s ) 2489s 2489s with self.create_zarr_target() as store: 2489s original.to_zarr(store, compute=False, **self.version_kwargs) 2489s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'u' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________________ TestZarrWriteEmpty.test_encoding_chunksizes[3] ________________ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_encoding_chunksizes(self) -> None: 2489s # regression test for GH2278 2489s # see also test_encoding_chunksizes_unlimited 2489s nx, ny, nt = 4, 4, 5 2489s original = xr.Dataset( 2489s {}, 2489s coords={ 2489s "x": np.arange(nx), 2489s "y": np.arange(ny), 2489s "t": np.arange(nt), 2489s }, 2489s ) 2489s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 2489s original = original.chunk({"t": 1, "x": 2, "y": 2}) 2489s 2489s > with self.roundtrip(original) as ds1: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'v' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______ TestZarrWriteEmpty.test_chunk_encoding_with_partial_dask_chunks[3] ______ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 2489s original = xr.Dataset( 2489s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 2489s ).chunk({"a": 3}) 2489s 2489s > with self.roundtrip( 2489s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 2489s ) as ds1: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'x' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________ TestZarrWriteEmpty.test_open_zarr_use_cftime[3] ________________ 2489s 2489s self = 2489s 2489s @requires_cftime 2489s def test_open_zarr_use_cftime(self) -> None: 2489s ds = create_test_data() 2489s with self.create_zarr_target() as store_target: 2489s ds.to_zarr(store_target, **self.version_kwargs) 2489s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'dim2' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_read_select_write[3] ______________ 2489s 2489s self = 2489s 2489s def test_write_read_select_write(self) -> None: 2489s # Test for https://github.com/pydata/xarray/issues/4084 2489s ds = create_test_data() 2489s 2489s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 2489s with self.create_zarr_target() as initial_store: 2489s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 2489s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'dim2' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s __________________ TestZarrWriteEmpty.test_attributes[3-obj1] __________________ 2489s 2489s self = 2489s obj = Size: 8B 2489s array(nan) 2489s Attributes: 2489s good: {'key': 'value'} 2489s 2489s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 2489s def test_attributes(self, obj) -> None: 2489s obj = obj.copy() 2489s 2489s obj.attrs["good"] = {"key": "value"} 2489s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 2489s with self.create_zarr_target() as store_target: 2489s ds.to_zarr(store_target, **self.version_kwargs) 2489s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2489s ds = open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'foo' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 2489s 2489s self = 2489s dtype = 'datetime64[ns]' 2489s 2489s @requires_dask 2489s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 2489s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 2489s # Generalized from @malmans2's test in PR #8253 2489s original = create_test_data().astype(dtype).chunk(1) 2489s > with self.roundtrip( 2489s original, 2489s open_kwargs={ 2489s "chunks": {}, 2489s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 2489s }, 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'dim2' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 2489s 2489s self = 2489s dtype = 'timedelta64[ns]' 2489s 2489s @requires_dask 2489s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 2489s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 2489s # Generalized from @malmans2's test in PR #8253 2489s original = create_test_data().astype(dtype).chunk(1) 2489s > with self.roundtrip( 2489s original, 2489s open_kwargs={ 2489s "chunks": {}, 2489s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 2489s }, 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'dim2' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ___________ TestZarrWriteEmpty.test_zarr_fill_value_setting[3-float] ___________ 2489s 2489s self = 2489s dtype = 2489s 2489s @requires_dask 2489s @pytest.mark.parametrize("dtype", [int, float]) 2489s def test_zarr_fill_value_setting(self, dtype): 2489s # When zarr_format=2, _FillValue sets fill_value 2489s # When zarr_format=3, fill_value is set independently 2489s # We test this by writing a dask array with compute=False, 2489s # on read we should receive chunks filled with `fill_value` 2489s fv = -1 2489s ds = xr.Dataset( 2489s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 2489s ) 2489s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 2489s 2489s zarr_format_2 = ( 2489s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 2489s ) or not has_zarr_v3 2489s if zarr_format_2: 2489s attr = "_FillValue" 2489s expected.foo.attrs[attr] = fv 2489s else: 2489s attr = "fill_value" 2489s if dtype is float: 2489s # for floats, Xarray inserts a default `np.nan` 2489s expected.foo.attrs["_FillValue"] = np.nan 2489s 2489s # turn off all decoding so we see what Zarr returns to us. 2489s # Since chunks, are not written, we should receive on `fill_value` 2489s open_kwargs = { 2489s "mask_and_scale": False, 2489s "consolidated": False, 2489s "use_zarr_fill_value_as_mask": False, 2489s } 2489s save_kwargs = dict(compute=False, consolidated=False) 2489s > with self.roundtrip( 2489s ds, 2489s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 2489s open_kwargs=open_kwargs, 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 2489s with self.open(store_target, **open_kwargs) as ds: 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 2489s with xr.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'foo' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________ TestZarrWriteEmpty.test_write_empty[3-True-True] _______________ 2489s 2489s self = 2489s consolidated = True, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_empty[3-True-False] _______________ 2489s 2489s self = 2489s consolidated = False, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________ TestZarrWriteEmpty.test_write_empty[3-True-None] _______________ 2489s 2489s self = 2489s consolidated = None, write_empty = True 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_empty[3-False-True] _______________ 2489s 2489s self = 2489s consolidated = True, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_empty[3-False-False] ______________ 2489s 2489s self = 2489s consolidated = False, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_empty[3-False-None] _______________ 2489s 2489s self = 2489s consolidated = None, write_empty = False 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________ TestZarrWriteEmpty.test_write_empty[3-None-True] _______________ 2489s 2489s self = 2489s consolidated = True, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrWriteEmpty.test_write_empty[3-None-False] _______________ 2489s 2489s self = 2489s consolidated = False, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________ TestZarrWriteEmpty.test_write_empty[3-None-None] _______________ 2489s 2489s self = 2489s consolidated = None, write_empty = None 2489s 2489s @pytest.mark.parametrize("consolidated", [True, False, None]) 2489s @pytest.mark.parametrize("write_empty", [True, False, None]) 2489s def test_write_empty( 2489s self, 2489s consolidated: bool | None, 2489s write_empty: bool | None, 2489s ) -> None: 2489s def assert_expected_files(expected: list[str], store: str) -> None: 2489s """Convenience for comparing with actual files written""" 2489s ls = [] 2489s test_root = os.path.join(store, "test") 2489s for root, _, files in os.walk(test_root): 2489s ls.extend( 2489s [ 2489s os.path.join(root, f).removeprefix(test_root).lstrip("/") 2489s for f in files 2489s ] 2489s ) 2489s 2489s assert set(expected) == set( 2489s [ 2489s file.lstrip("c/") 2489s for file in ls 2489s if (file not in (".zattrs", ".zarray", "zarr.json")) 2489s ] 2489s ) 2489s 2489s # The zarr format is set by the `default_zarr_format` 2489s # pytest fixture that acts on a superclass 2489s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 2489s if (write_empty is False) or (write_empty is None and has_zarr_v3): 2489s expected = ["0.1.0"] 2489s else: 2489s expected = [ 2489s "0.0.0", 2489s "0.0.1", 2489s "0.1.0", 2489s "0.1.1", 2489s ] 2489s 2489s if zarr_format_3: 2489s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 2489s # transform to the path style of zarr 3 2489s # e.g. 0/0/1 2489s expected = [e.replace(".", "/") for e in expected] 2489s else: 2489s # use nan for default fill_value behaviour 2489s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 2489s 2489s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 2489s 2489s if has_dask: 2489s ds["test"] = ds["test"].chunk(1) 2489s encoding = None 2489s else: 2489s encoding = {"test": {"chunks": (1, 1, 1)}} 2489s 2489s with self.temp_dir() as (d, store): 2489s ds.to_zarr( 2489s store, 2489s mode="w", 2489s encoding=encoding, 2489s write_empty_chunks=write_empty, 2489s ) 2489s 2489s # check expected files after a write 2489s assert_expected_files(expected, store) 2489s 2489s > with self.roundtrip_dir( 2489s ds, 2489s store, 2489s save_kwargs={ 2489s "mode": "a", 2489s "append_dim": "Z", 2489s "write_empty_chunks": write_empty, 2489s }, 2489s ) as a_ds: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3.13/contextlib.py:141: in __enter__ 2489s return next(self.gen) 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 2489s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-full-auto] _____________ 2489s 2489s self = 2489s region = 'auto' 2489s 2489s @pytest.mark.parametrize( 2489s "region", 2489s [ 2489s pytest.param("auto", id="full-auto"), 2489s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 2489s ], 2489s ) 2489s def test_zarr_region_auto(self, region): 2489s with self.create() as (target, ds): 2489s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 2489s > self.save(target, ds_region, region=region) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-mixed-auto] ____________ 2489s 2489s self = 2489s region = {'x': slice(np.int32(2), np.int32(4), None), 'y': slice(6, 8, None)} 2489s 2489s @pytest.mark.parametrize( 2489s "region", 2489s [ 2489s pytest.param("auto", id="full-auto"), 2489s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 2489s ], 2489s ) 2489s def test_zarr_region_auto(self, region): 2489s with self.create() as (target, ds): 2489s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 2489s > self.save(target, ds_region, region=region) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ______________ TestZarrRegionAuto.test_zarr_region_index_write[3] ______________ 2489s 2489s self = 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_zarr_region_index_write_30') 2489s 2489s def test_zarr_region_index_write(self, tmp_path): 2489s region: Mapping[str, slice] | Literal["auto"] 2489s region_slice = dict(x=slice(2, 4), y=slice(6, 8)) 2489s 2489s with self.create() as (target, ds): 2489s ds_region = 1 + ds.isel(region_slice) 2489s for region in [region_slice, "auto"]: # type: ignore[assignment] 2489s with patch.object( 2489s ZarrStore, 2489s "set_variables", 2489s side_effect=ZarrStore.set_variables, 2489s autospec=True, 2489s ) as mock: 2489s > self.save(target, ds_region, region=region, mode="r+") 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6336: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ____________________ TestZarrRegionAuto.test_zarr_region[3] ____________________ 2489s 2489s self = 2489s 2489s def test_zarr_region(self): 2489s with self.create() as (target, ds): 2489s ds_transposed = ds.transpose("y", "x") 2489s ds_region = 1 + ds_transposed.isel(x=[0], y=[0]) 2489s > self.save(target, ds_region, region={"x": slice(0, 1), "y": slice(0, 1)}) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6369: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _____________ TestZarrRegionAuto.test_zarr_append_chunk_partial[3] _____________ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_zarr_append_chunk_partial(self): 2489s t_coords = np.array([np.datetime64("2020-01-01").astype("datetime64[ns]")]) 2489s data = np.ones((10, 10)) 2489s 2489s da = xr.DataArray( 2489s data.reshape((-1, 10, 10)), 2489s dims=["time", "x", "y"], 2489s coords={"time": t_coords}, 2489s name="foo", 2489s ) 2489s new_time = np.array([np.datetime64("2021-01-01").astype("datetime64[ns]")]) 2489s da2 = xr.DataArray( 2489s data.reshape((-1, 10, 10)), 2489s dims=["time", "x", "y"], 2489s coords={"time": new_time}, 2489s name="foo", 2489s ) 2489s 2489s with self.create_zarr_target() as target: 2489s self.save(target, da, mode="w", encoding={"foo": {"chunks": (5, 5, 1)}}) 2489s 2489s with pytest.raises(ValueError, match="encoding was provided"): 2489s self.save( 2489s target, 2489s da2, 2489s append_dim="time", 2489s mode="a", 2489s encoding={"foo": {"chunks": (1, 1, 1)}}, 2489s ) 2489s 2489s # chunking with dask sidesteps the encoding check, so we need a different check 2489s with pytest.raises(ValueError, match="Specified zarr chunks"): 2489s > self.save( 2489s target, 2489s da2.chunk({"x": 1, "y": 1, "time": 1}), 2489s append_dim="time", 2489s mode="a", 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6426: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'foo' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _________ TestZarrRegionAuto.test_zarr_region_chunk_partial_offset[3] __________ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_zarr_region_chunk_partial_offset(self): 2489s # https://github.com/pydata/xarray/pull/8459#issuecomment-1819417545 2489s with self.create_zarr_target() as store: 2489s data = np.ones((30,)) 2489s da = xr.DataArray( 2489s data, dims=["x"], coords={"x": range(30)}, name="foo" 2489s ).chunk(x=10) 2489s self.save(store, da, compute=False) 2489s 2489s > self.save(store, da.isel(x=slice(10)).chunk(x=(10,)), region="auto") 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6443: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'foo' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ____________ TestZarrRegionAuto.test_zarr_safe_chunk_append_dim[3] _____________ 2489s 2489s self = 2489s 2489s @requires_dask 2489s def test_zarr_safe_chunk_append_dim(self): 2489s with self.create_zarr_target() as store: 2489s data = np.ones((20,)) 2489s da = xr.DataArray( 2489s data, dims=["x"], coords={"x": range(20)}, name="foo" 2489s ).chunk(x=5) 2489s 2489s self.save(store, da.isel(x=slice(0, 7)), safe_chunks=True, mode="w") 2489s with pytest.raises(ValueError): 2489s # If the first chunk is smaller than the border size then raise an error 2489s > self.save( 2489s store, 2489s da.isel(x=slice(7, 11)).chunk(x=(2, 2)), 2489s append_dim="x", 2489s safe_chunks=True, 2489s ) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6468: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'foo' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-r+] _____________ 2489s 2489s self = 2489s mode = 'r+' 2489s 2489s @requires_dask 2489s @pytest.mark.parametrize("mode", ["r+", "a"]) 2489s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 2489s with self.create_zarr_target() as store: 2489s arr = xr.DataArray( 2489s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 2489s ).chunk(a=3) 2489s self.save(store, arr, mode="w") 2489s 2489s with pytest.raises(ValueError): 2489s # There are two Dask chunks on the same Zarr chunk, 2489s # which means that it is unsafe in any mode 2489s self.save( 2489s store, 2489s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 2489s region="auto", 2489s mode=mode, 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # the first chunk is covering the border size, but it is not 2489s # completely covering the second chunk, which means that it is 2489s # unsafe in any mode 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 2489s region="auto", 2489s mode=mode, 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # The first chunk is safe but the other two chunks are overlapping with 2489s # the same Zarr chunk 2489s self.save( 2489s store, 2489s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 2489s region="auto", 2489s mode=mode, 2489s ) 2489s 2489s # Fully update two contiguous chunks is safe in any mode 2489s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 2489s 2489s # The last chunk is considered full based on their current size (2) 2489s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 2489s self.save( 2489s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 2489s ) 2489s 2489s # Write the last chunk of a region partially is safe in "a" mode 2489s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 2489s with pytest.raises(ValueError): 2489s # with "r+" mode it is invalid to write partial chunk 2489s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 2489s 2489s # This is safe with mode "a", the border size is covered by the first chunk of Dask 2489s self.save( 2489s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 2489s ) 2489s with pytest.raises(ValueError): 2489s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s # This is safe on mode "a" because there is a single dask chunk 2489s self.save( 2489s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 2489s ) 2489s with pytest.raises(ValueError): 2489s # This is unsafe on mode "r+", because the Dask chunk is partially writing 2489s # in the first chunk of Zarr 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s # The first chunk is completely covering the first Zarr chunk 2489s # and the last chunk is a partial one 2489s self.save( 2489s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # The last chunk is partial, so it is considered unsafe on mode "r+" 2489s self.save( 2489s store, 2489s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s # The first chunk is covering the border size (2 elements) 2489s # and also the second chunk (3 elements), so it is valid 2489s self.save( 2489s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # The first chunk is not fully covering the first zarr chunk 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # Validate that the border condition is not affecting the "r+" mode 2489s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 2489s 2489s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 2489s with pytest.raises(ValueError): 2489s # Validate that even if we write with a single Dask chunk on the last Zarr 2489s # chunk it is still unsafe if it is not fully covering it 2489s # (the last Zarr chunk has size 2) 2489s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 2489s 2489s # Validate the same as the above test but in the beginning of the last chunk 2489s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 2489s with pytest.raises(ValueError): 2489s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 2489s 2489s self.save( 2489s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 2489s ) 2489s with pytest.raises(ValueError): 2489s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 2489s # if it is partial covering other Zarr chunks 2489s self.save( 2489s store, 2489s arr.isel(a=slice(7, None)).chunk(a=-1), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # If the chunk is of size equal to the one in the Zarr encoding, but 2489s # it is partially writing in the first chunk then raise an error 2489s self.save( 2489s store, 2489s arr.isel(a=slice(8, None)).chunk(a=3), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s self.save( 2489s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 2489s ) 2489s 2489s # Test if the code is detecting the last chunk correctly 2489s data = np.random.default_rng(0).random((2920, 25, 53)) 2489s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 2489s chunks = {"time": 1000, "lat": 25, "lon": 53} 2489s self.save(store, ds.chunk(chunks), compute=False, mode="w") 2489s region = {"time": slice(1000, 2000, 1)} 2489s chunk = ds.isel(region) 2489s chunk = chunk.chunk() 2489s > self.save(store, chunk.chunk(), region=region) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = 2489s name = 'temperature' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-a] ______________ 2489s 2489s self = 2489s mode = 'a' 2489s 2489s @requires_dask 2489s @pytest.mark.parametrize("mode", ["r+", "a"]) 2489s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 2489s with self.create_zarr_target() as store: 2489s arr = xr.DataArray( 2489s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 2489s ).chunk(a=3) 2489s self.save(store, arr, mode="w") 2489s 2489s with pytest.raises(ValueError): 2489s # There are two Dask chunks on the same Zarr chunk, 2489s # which means that it is unsafe in any mode 2489s self.save( 2489s store, 2489s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 2489s region="auto", 2489s mode=mode, 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # the first chunk is covering the border size, but it is not 2489s # completely covering the second chunk, which means that it is 2489s # unsafe in any mode 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 2489s region="auto", 2489s mode=mode, 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # The first chunk is safe but the other two chunks are overlapping with 2489s # the same Zarr chunk 2489s self.save( 2489s store, 2489s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 2489s region="auto", 2489s mode=mode, 2489s ) 2489s 2489s # Fully update two contiguous chunks is safe in any mode 2489s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 2489s 2489s # The last chunk is considered full based on their current size (2) 2489s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 2489s self.save( 2489s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 2489s ) 2489s 2489s # Write the last chunk of a region partially is safe in "a" mode 2489s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 2489s with pytest.raises(ValueError): 2489s # with "r+" mode it is invalid to write partial chunk 2489s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 2489s 2489s # This is safe with mode "a", the border size is covered by the first chunk of Dask 2489s self.save( 2489s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 2489s ) 2489s with pytest.raises(ValueError): 2489s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s # This is safe on mode "a" because there is a single dask chunk 2489s self.save( 2489s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 2489s ) 2489s with pytest.raises(ValueError): 2489s # This is unsafe on mode "r+", because the Dask chunk is partially writing 2489s # in the first chunk of Zarr 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s # The first chunk is completely covering the first Zarr chunk 2489s # and the last chunk is a partial one 2489s self.save( 2489s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # The last chunk is partial, so it is considered unsafe on mode "r+" 2489s self.save( 2489s store, 2489s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s # The first chunk is covering the border size (2 elements) 2489s # and also the second chunk (3 elements), so it is valid 2489s self.save( 2489s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # The first chunk is not fully covering the first zarr chunk 2489s self.save( 2489s store, 2489s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # Validate that the border condition is not affecting the "r+" mode 2489s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 2489s 2489s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 2489s with pytest.raises(ValueError): 2489s # Validate that even if we write with a single Dask chunk on the last Zarr 2489s # chunk it is still unsafe if it is not fully covering it 2489s # (the last Zarr chunk has size 2) 2489s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 2489s 2489s # Validate the same as the above test but in the beginning of the last chunk 2489s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 2489s with pytest.raises(ValueError): 2489s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 2489s 2489s self.save( 2489s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 2489s ) 2489s with pytest.raises(ValueError): 2489s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 2489s # if it is partial covering other Zarr chunks 2489s self.save( 2489s store, 2489s arr.isel(a=slice(7, None)).chunk(a=-1), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s # If the chunk is of size equal to the one in the Zarr encoding, but 2489s # it is partially writing in the first chunk then raise an error 2489s self.save( 2489s store, 2489s arr.isel(a=slice(8, None)).chunk(a=3), 2489s region="auto", 2489s mode="r+", 2489s ) 2489s 2489s with pytest.raises(ValueError): 2489s self.save( 2489s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 2489s ) 2489s 2489s # Test if the code is detecting the last chunk correctly 2489s data = np.random.default_rng(0).random((2920, 25, 53)) 2489s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 2489s chunks = {"time": 1000, "lat": 25, "lon": 53} 2489s self.save(store, ds.chunk(chunks), compute=False, mode="w") 2489s region = {"time": slice(1000, 2000, 1)} 2489s chunk = ds.isel(region) 2489s chunk = chunk.chunk() 2489s > self.save(store, chunk.chunk(), region=region) 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 2489s ds.to_zarr(target, **kwargs) 2489s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 2489s return to_zarr( # type: ignore[call-overload,misc] 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 2489s dump_to_store(dataset, zstore, writer, encoding=encoding) 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 2489s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 2489s k: self.open_store_variable(name=k) for k in existing_variable_names 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = 2489s name = 'temperature' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ____________________ test_open_dataset_chunking_zarr[auto] _____________________ 2489s 2489s chunks = 'auto' 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar0') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 2489s encoded_chunks = 100 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _____________________ test_open_dataset_chunking_zarr[-1] ______________________ 2489s 2489s chunks = -1 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar1') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 2489s encoded_chunks = 100 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ___________________ test_open_dataset_chunking_zarr[chunks2] ___________________ 2489s 2489s chunks = {} 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar2') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 2489s encoded_chunks = 100 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ___________________ test_open_dataset_chunking_zarr[chunks3] ___________________ 2489s 2489s chunks = {'x': 'auto'} 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar3') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 2489s encoded_chunks = 100 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ___________________ test_open_dataset_chunking_zarr[chunks4] ___________________ 2489s 2489s chunks = {'x': -1} 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar4') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 2489s encoded_chunks = 100 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ___________________ test_open_dataset_chunking_zarr[chunks5] ___________________ 2489s 2489s chunks = {'x': 'auto', 'y': -1} 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar5') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 2489s encoded_chunks = 100 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s _______________________ test_chunking_consintency[auto] ________________________ 2489s 2489s chunks = 'auto' 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_auto0') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 2489s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 2489s encoded_chunks: dict[str, Any] = {} 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s ds.to_netcdf(tmp_path / "test.nc") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with xr.open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s 2489s self = , name = 'test' 2489s 2489s def open_store_variable(self, name): 2489s zarr_array = self.members[name] 2489s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2489s try_nczarr = self._mode == "r" 2489s dimensions, attributes = _get_zarr_dims_and_attrs( 2489s zarr_array, DIMENSION_KEY, try_nczarr 2489s ) 2489s attributes = dict(attributes) 2489s 2489s encoding = { 2489s "chunks": zarr_array.chunks, 2489s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2489s } 2489s 2489s if _zarr_v3(): 2489s encoding.update( 2489s { 2489s "compressors": zarr_array.compressors, 2489s "filters": zarr_array.filters, 2489s "shards": zarr_array.shards, 2489s } 2489s ) 2489s if self.zarr_group.metadata.zarr_format == 3: 2489s encoding.update({"serializer": zarr_array.serializer}) 2489s else: 2489s encoding.update( 2489s { 2489s "compressor": zarr_array.compressor, 2489s "filters": zarr_array.filters, 2489s } 2489s ) 2489s 2489s if self._use_zarr_fill_value_as_mask: 2489s # Setting this attribute triggers CF decoding for missing values 2489s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2489s if zarr_array.fill_value is not None: 2489s attributes["_FillValue"] = zarr_array.fill_value 2489s elif "_FillValue" in attributes: 2489s original_zarr_dtype = zarr_array.metadata.data_type 2489s attributes["_FillValue"] = FillValueCoder.decode( 2489s > attributes["_FillValue"], original_zarr_dtype.value 2489s ) 2489s E AttributeError: 'Float64' object has no attribute 'value' 2489s 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2489s ________________________ test_chunking_consintency[-1] _________________________ 2489s 2489s chunks = -1 2489s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency__1_0') 2489s 2489s @requires_zarr 2489s @requires_dask 2489s @pytest.mark.parametrize( 2489s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2489s ) 2489s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 2489s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 2489s encoded_chunks: dict[str, Any] = {} 2489s dask_arr = da.from_array( 2489s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2489s ) 2489s ds = xr.Dataset( 2489s { 2489s "test": xr.DataArray( 2489s dask_arr, 2489s dims=("x", "y"), 2489s ) 2489s } 2489s ) 2489s ds["test"].encoding["chunks"] = encoded_chunks 2489s ds.to_zarr(tmp_path / "test.zarr") 2489s ds.to_netcdf(tmp_path / "test.nc") 2489s 2489s with dask.config.set({"array.chunk-size": "1MiB"}): 2489s expected = ds.chunk(chunks) 2489s > with xr.open_dataset( 2489s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2489s ) as actual: 2489s 2489s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 2489s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2489s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2489s backend_ds = backend.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2489s ds = store_entrypoint.open_dataset( 2489s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2489s vars, attrs = filename_or_obj.load() 2489s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2489s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2489s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2489s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2489s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2489s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'test' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ______________________ test_chunking_consintency[chunks2] ______________________ 2490s 2490s chunks = {} 2490s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun0') 2490s 2490s @requires_zarr 2490s @requires_dask 2490s @pytest.mark.parametrize( 2490s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2490s ) 2490s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 2490s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 2490s encoded_chunks: dict[str, Any] = {} 2490s dask_arr = da.from_array( 2490s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2490s ) 2490s ds = xr.Dataset( 2490s { 2490s "test": xr.DataArray( 2490s dask_arr, 2490s dims=("x", "y"), 2490s ) 2490s } 2490s ) 2490s ds["test"].encoding["chunks"] = encoded_chunks 2490s ds.to_zarr(tmp_path / "test.zarr") 2490s ds.to_netcdf(tmp_path / "test.nc") 2490s 2490s with dask.config.set({"array.chunk-size": "1MiB"}): 2490s expected = ds.chunk(chunks) 2490s > with xr.open_dataset( 2490s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2490s ) as actual: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2490s backend_ds = backend.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2490s ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'test' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ______________________ test_chunking_consintency[chunks3] ______________________ 2490s 2490s chunks = {'x': 'auto'} 2490s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun1') 2490s 2490s @requires_zarr 2490s @requires_dask 2490s @pytest.mark.parametrize( 2490s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2490s ) 2490s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 2490s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 2490s encoded_chunks: dict[str, Any] = {} 2490s dask_arr = da.from_array( 2490s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2490s ) 2490s ds = xr.Dataset( 2490s { 2490s "test": xr.DataArray( 2490s dask_arr, 2490s dims=("x", "y"), 2490s ) 2490s } 2490s ) 2490s ds["test"].encoding["chunks"] = encoded_chunks 2490s ds.to_zarr(tmp_path / "test.zarr") 2490s ds.to_netcdf(tmp_path / "test.nc") 2490s 2490s with dask.config.set({"array.chunk-size": "1MiB"}): 2490s expected = ds.chunk(chunks) 2490s > with xr.open_dataset( 2490s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2490s ) as actual: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2490s backend_ds = backend.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2490s ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'test' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ______________________ test_chunking_consintency[chunks4] ______________________ 2490s 2490s chunks = {'x': -1} 2490s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun2') 2490s 2490s @requires_zarr 2490s @requires_dask 2490s @pytest.mark.parametrize( 2490s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2490s ) 2490s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 2490s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 2490s encoded_chunks: dict[str, Any] = {} 2490s dask_arr = da.from_array( 2490s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2490s ) 2490s ds = xr.Dataset( 2490s { 2490s "test": xr.DataArray( 2490s dask_arr, 2490s dims=("x", "y"), 2490s ) 2490s } 2490s ) 2490s ds["test"].encoding["chunks"] = encoded_chunks 2490s ds.to_zarr(tmp_path / "test.zarr") 2490s ds.to_netcdf(tmp_path / "test.nc") 2490s 2490s with dask.config.set({"array.chunk-size": "1MiB"}): 2490s expected = ds.chunk(chunks) 2490s > with xr.open_dataset( 2490s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2490s ) as actual: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2490s backend_ds = backend.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2490s ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'test' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ______________________ test_chunking_consintency[chunks5] ______________________ 2490s 2490s chunks = {'x': 'auto', 'y': -1} 2490s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun3') 2490s 2490s @requires_zarr 2490s @requires_dask 2490s @pytest.mark.parametrize( 2490s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 2490s ) 2490s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 2490s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 2490s encoded_chunks: dict[str, Any] = {} 2490s dask_arr = da.from_array( 2490s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 2490s ) 2490s ds = xr.Dataset( 2490s { 2490s "test": xr.DataArray( 2490s dask_arr, 2490s dims=("x", "y"), 2490s ) 2490s } 2490s ) 2490s ds["test"].encoding["chunks"] = encoded_chunks 2490s ds.to_zarr(tmp_path / "test.zarr") 2490s ds.to_netcdf(tmp_path / "test.nc") 2490s 2490s with dask.config.set({"array.chunk-size": "1MiB"}): 2490s expected = ds.chunk(chunks) 2490s > with xr.open_dataset( 2490s tmp_path / "test.zarr", engine="zarr", chunks=chunks 2490s ) as actual: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2490s backend_ds = backend.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2490s ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'test' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ______________________ TestNCZarr.test_overwriting_nczarr ______________________ 2490s 2490s self = 2490s 2490s def test_overwriting_nczarr(self) -> None: 2490s with create_tmp_file(suffix=".zarr") as tmp: 2490s ds = self._create_nczarr(tmp) 2490s expected = ds[["var1"]] 2490s expected.to_zarr(tmp, mode="w") 2490s > actual = xr.open_zarr(tmp, consolidated=False) 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6223: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 2490s ds = open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 2490s backend_ds = backend.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 2490s ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'dim2' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ________________ TestZarrDatatreeIO.test_to_zarr[zarr_format=3] ________________ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zarr_format_3_0') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s zarr_format = 3 2490s 2490s def test_to_zarr(self, tmpdir, simple_datatree, zarr_format): 2490s filepath = str(tmpdir / "test.zarr") 2490s original_dt = simple_datatree 2490s original_dt.to_zarr(filepath, zarr_format=zarr_format) 2490s 2490s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:459: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s _____________ TestZarrDatatreeIO.test_zarr_encoding[zarr_format=3] _____________ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_zarr_encoding_zarr_format1') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s zarr_format = 3 2490s 2490s def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format): 2490s filepath = str(tmpdir / "test.zarr") 2490s original_dt = simple_datatree 2490s 2490s if zarr_format == 2: 2490s from numcodecs.blosc import Blosc 2490s 2490s codec = Blosc(cname="zstd", clevel=3, shuffle=2) 2490s comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec} 2490s elif zarr_format == 3: 2490s # specifying codecs in zarr_format=3 requires importing from zarr 3 namespace 2490s import numcodecs.zarr3 2490s 2490s comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)} 2490s 2490s enc = {"/set2": {var: comp for var in original_dt["/set2"].dataset.data_vars}} 2490s original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format) 2490s 2490s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:480: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=2] ___________ 2490s 2490s cls = 2490s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 2490s path = '', mode = 'r' 2490s 2490s @classmethod 2490s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 2490s """ 2490s Open StorePath based on the provided mode. 2490s 2490s * If the mode is None, return an opened version of the store with no changes. 2490s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 2490s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 2490s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 2490s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 2490s 2490s Parameters 2490s ---------- 2490s mode : AccessModeLiteral 2490s The mode to use when initializing the store path. 2490s 2490s The accepted values are: 2490s 2490s - ``'r'``: read only (must exist) 2490s - ``'r+'``: read/write (must exist) 2490s - ``'a'``: read/write (create if doesn't exist) 2490s - ``'w'``: read/write (overwrite if exists) 2490s - ``'w-'``: read/write (create if doesn't exist). 2490s 2490s Raises 2490s ------ 2490s FileExistsError 2490s If the mode is 'w-' and the store path already exists. 2490s ValueError 2490s If the mode is not "r" and the store is read-only, or 2490s """ 2490s 2490s # fastpath if mode is None 2490s if mode is None: 2490s return await cls._create_open_instance(store, path) 2490s 2490s if mode not in ANY_ACCESS_MODE: 2490s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 2490s 2490s if store.read_only: 2490s # Don't allow write operations on a read-only store 2490s if mode != "r": 2490s raise ValueError( 2490s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 2490s ) 2490s self = await cls._create_open_instance(store, path) 2490s elif mode == "r": 2490s # Create read-only copy for read mode on writable store 2490s try: 2490s > read_only_store = store.with_read_only(True) 2490s 2490s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 2490s read_only = True 2490s 2490s def with_read_only(self, read_only: bool = False) -> Store: 2490s """ 2490s Return a new store with a new read_only setting. 2490s 2490s The new store points to the same location with the specified new read_only state. 2490s The returned Store is not automatically opened, and this store is 2490s not automatically closed. 2490s 2490s Parameters 2490s ---------- 2490s read_only 2490s If True, the store will be created in read-only mode. Defaults to False. 2490s 2490s Returns 2490s ------- 2490s A new store of the same type with the new read only attribute. 2490s """ 2490s > raise NotImplementedError( 2490s f"with_read_only is not implemented for the {type(self)} store type." 2490s ) 2490s E NotImplementedError: with_read_only is not implemented for the store type. 2490s 2490s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 2490s 2490s The above exception was the direct cause of the following exception: 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s zarr_format = 2 2490s 2490s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 2490s from zarr.storage import ZipStore 2490s 2490s filepath = str(tmpdir / "test.zarr.zip") 2490s original_dt = simple_datatree 2490s store = ZipStore(filepath, mode="w") 2490s original_dt.to_zarr(store, zarr_format=zarr_format) 2490s 2490s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 2490s stores = ZarrStore.open_store( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 2490s ) = _get_open_params( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 2490s zarr_root_group = zarr.open_group(store, **open_kwargs) 2490s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 2490s sync( 2490s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2490s raise return_result 2490s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2490s return await coro 2490s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2490s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2490s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 2490s return await StorePath.open(store, path=path_normalized, mode=mode) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s cls = 2490s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 2490s path = '', mode = 'r' 2490s 2490s @classmethod 2490s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 2490s """ 2490s Open StorePath based on the provided mode. 2490s 2490s * If the mode is None, return an opened version of the store with no changes. 2490s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 2490s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 2490s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 2490s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 2490s 2490s Parameters 2490s ---------- 2490s mode : AccessModeLiteral 2490s The mode to use when initializing the store path. 2490s 2490s The accepted values are: 2490s 2490s - ``'r'``: read only (must exist) 2490s - ``'r+'``: read/write (must exist) 2490s - ``'a'``: read/write (create if doesn't exist) 2490s - ``'w'``: read/write (overwrite if exists) 2490s - ``'w-'``: read/write (create if doesn't exist). 2490s 2490s Raises 2490s ------ 2490s FileExistsError 2490s If the mode is 'w-' and the store path already exists. 2490s ValueError 2490s If the mode is not "r" and the store is read-only, or 2490s """ 2490s 2490s # fastpath if mode is None 2490s if mode is None: 2490s return await cls._create_open_instance(store, path) 2490s 2490s if mode not in ANY_ACCESS_MODE: 2490s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 2490s 2490s if store.read_only: 2490s # Don't allow write operations on a read-only store 2490s if mode != "r": 2490s raise ValueError( 2490s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 2490s ) 2490s self = await cls._create_open_instance(store, path) 2490s elif mode == "r": 2490s # Create read-only copy for read mode on writable store 2490s try: 2490s read_only_store = store.with_read_only(True) 2490s except NotImplementedError as e: 2490s > raise ValueError( 2490s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 2490s "Please use a read-only store or a storage class that implements .with_read_only()." 2490s ) from e 2490s 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(). 2490s 2490s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 2490s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=3] ___________ 2490s 2490s cls = 2490s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 2490s path = '', mode = 'r' 2490s 2490s @classmethod 2490s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 2490s """ 2490s Open StorePath based on the provided mode. 2490s 2490s * If the mode is None, return an opened version of the store with no changes. 2490s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 2490s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 2490s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 2490s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 2490s 2490s Parameters 2490s ---------- 2490s mode : AccessModeLiteral 2490s The mode to use when initializing the store path. 2490s 2490s The accepted values are: 2490s 2490s - ``'r'``: read only (must exist) 2490s - ``'r+'``: read/write (must exist) 2490s - ``'a'``: read/write (create if doesn't exist) 2490s - ``'w'``: read/write (overwrite if exists) 2490s - ``'w-'``: read/write (create if doesn't exist). 2490s 2490s Raises 2490s ------ 2490s FileExistsError 2490s If the mode is 'w-' and the store path already exists. 2490s ValueError 2490s If the mode is not "r" and the store is read-only, or 2490s """ 2490s 2490s # fastpath if mode is None 2490s if mode is None: 2490s return await cls._create_open_instance(store, path) 2490s 2490s if mode not in ANY_ACCESS_MODE: 2490s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 2490s 2490s if store.read_only: 2490s # Don't allow write operations on a read-only store 2490s if mode != "r": 2490s raise ValueError( 2490s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 2490s ) 2490s self = await cls._create_open_instance(store, path) 2490s elif mode == "r": 2490s # Create read-only copy for read mode on writable store 2490s try: 2490s > read_only_store = store.with_read_only(True) 2490s 2490s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 2490s read_only = True 2490s 2490s def with_read_only(self, read_only: bool = False) -> Store: 2490s """ 2490s Return a new store with a new read_only setting. 2490s 2490s The new store points to the same location with the specified new read_only state. 2490s The returned Store is not automatically opened, and this store is 2490s not automatically closed. 2490s 2490s Parameters 2490s ---------- 2490s read_only 2490s If True, the store will be created in read-only mode. Defaults to False. 2490s 2490s Returns 2490s ------- 2490s A new store of the same type with the new read only attribute. 2490s """ 2490s > raise NotImplementedError( 2490s f"with_read_only is not implemented for the {type(self)} store type." 2490s ) 2490s E NotImplementedError: with_read_only is not implemented for the store type. 2490s 2490s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 2490s 2490s The above exception was the direct cause of the following exception: 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s zarr_format = 3 2490s 2490s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 2490s from zarr.storage import ZipStore 2490s 2490s filepath = str(tmpdir / "test.zarr.zip") 2490s original_dt = simple_datatree 2490s store = ZipStore(filepath, mode="w") 2490s original_dt.to_zarr(store, zarr_format=zarr_format) 2490s 2490s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 2490s stores = ZarrStore.open_store( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 2490s ) = _get_open_params( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 2490s zarr_root_group = zarr.open_group(store, **open_kwargs) 2490s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 2490s sync( 2490s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 2490s raise return_result 2490s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 2490s return await coro 2490s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 2490s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 2490s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 2490s return await StorePath.open(store, path=path_normalized, mode=mode) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s cls = 2490s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 2490s path = '', mode = 'r' 2490s 2490s @classmethod 2490s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 2490s """ 2490s Open StorePath based on the provided mode. 2490s 2490s * If the mode is None, return an opened version of the store with no changes. 2490s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 2490s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 2490s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 2490s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 2490s 2490s Parameters 2490s ---------- 2490s mode : AccessModeLiteral 2490s The mode to use when initializing the store path. 2490s 2490s The accepted values are: 2490s 2490s - ``'r'``: read only (must exist) 2490s - ``'r+'``: read/write (must exist) 2490s - ``'a'``: read/write (create if doesn't exist) 2490s - ``'w'``: read/write (overwrite if exists) 2490s - ``'w-'``: read/write (create if doesn't exist). 2490s 2490s Raises 2490s ------ 2490s FileExistsError 2490s If the mode is 'w-' and the store path already exists. 2490s ValueError 2490s If the mode is not "r" and the store is read-only, or 2490s """ 2490s 2490s # fastpath if mode is None 2490s if mode is None: 2490s return await cls._create_open_instance(store, path) 2490s 2490s if mode not in ANY_ACCESS_MODE: 2490s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 2490s 2490s if store.read_only: 2490s # Don't allow write operations on a read-only store 2490s if mode != "r": 2490s raise ValueError( 2490s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 2490s ) 2490s self = await cls._create_open_instance(store, path) 2490s elif mode == "r": 2490s # Create read-only copy for read mode on writable store 2490s try: 2490s read_only_store = store.with_read_only(True) 2490s except NotImplementedError as e: 2490s > raise ValueError( 2490s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 2490s "Please use a read-only store or a storage class that implements .with_read_only()." 2490s ) from e 2490s 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(). 2490s 2490s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 2490s _______ TestZarrDatatreeIO.test_to_zarr_not_consolidated[zarr_format=3] ________ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_not_consolidated_1') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s zarr_format = 3 2490s 2490s def test_to_zarr_not_consolidated(self, tmpdir, simple_datatree, zarr_format): 2490s filepath = tmpdir / "test.zarr" 2490s zmetadata = filepath / ".zmetadata" 2490s s1zmetadata = filepath / "set1" / ".zmetadata" 2490s filepath = str(filepath) # casting to str avoids a pathlib bug in xarray 2490s original_dt = simple_datatree 2490s original_dt.to_zarr(filepath, consolidated=False, zarr_format=zarr_format) 2490s assert not zmetadata.exists() 2490s assert not s1zmetadata.exists() 2490s 2490s with pytest.warns(RuntimeWarning, match="consolidated"): 2490s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:514: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ________ TestZarrDatatreeIO.test_open_groups_round_trip[zarr_format=3] _________ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_groups_round_trip_za1') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s zarr_format = 3 2490s 2490s def test_open_groups_round_trip(self, tmpdir, simple_datatree, zarr_format) -> None: 2490s """Test `open_groups` opens a zarr store with the `simple_datatree` structure.""" 2490s filepath = str(tmpdir / "test.zarr") 2490s original_dt = simple_datatree 2490s original_dt.to_zarr(filepath, zarr_format=zarr_format) 2490s 2490s > roundtrip_dict = open_groups(filepath, engine="zarr") 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:631: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 2490s backend_groups = backend.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s _____________ TestZarrDatatreeIO.test_open_datatree[zarr_format=3] _____________ 2490s 2490s self = 2490s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xdb0dfe88> 2490s zarr_format = 3 2490s 2490s @pytest.mark.filterwarnings( 2490s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 2490s ) 2490s def test_open_datatree(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 2490s """Test if `open_datatree` fails to open a zarr store with an unaligned group hierarchy.""" 2490s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 2490s 2490s with pytest.raises( 2490s ValueError, 2490s match=( 2490s re.escape("group '/Group2' is not aligned with its parents:") + ".*" 2490s ), 2490s ): 2490s > open_datatree(storepath, engine="zarr") 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:653: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s _________ TestZarrDatatreeIO.test_open_datatree_chunks[zarr_format=3] __________ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_chunks_zarr1') 2490s zarr_format = 3 2490s 2490s @requires_dask 2490s def test_open_datatree_chunks(self, tmpdir, zarr_format) -> None: 2490s filepath = str(tmpdir / "test.zarr") 2490s 2490s chunks = {"x": 2, "y": 1} 2490s 2490s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 2490s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 2490s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 2490s original_tree = DataTree.from_dict( 2490s { 2490s "/": root_data.chunk(chunks), 2490s "/group1": set1_data.chunk(chunks), 2490s "/group2": set2_data.chunk(chunks), 2490s } 2490s ) 2490s original_tree.to_zarr(filepath, zarr_format=zarr_format) 2490s 2490s > with open_datatree(filepath, engine="zarr", chunks=chunks) as tree: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:673: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ______________ TestZarrDatatreeIO.test_open_groups[zarr_format=3] ______________ 2490s 2490s self = 2490s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xdb0dfe88> 2490s zarr_format = 3 2490s 2490s @pytest.mark.filterwarnings( 2490s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 2490s ) 2490s def test_open_groups(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 2490s """Test `open_groups` with a zarr store of an unaligned group hierarchy.""" 2490s 2490s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 2490s > unaligned_dict_of_datasets = open_groups(storepath, engine="zarr") 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:689: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 2490s backend_groups = backend.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[True-zarr_format=3] ___ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr2') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s write_consolidated_metadata = True, zarr_format = 3 2490s 2490s @pytest.mark.filterwarnings( 2490s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 2490s ) 2490s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 2490s def test_open_datatree_specific_group( 2490s self, 2490s tmpdir, 2490s simple_datatree, 2490s write_consolidated_metadata, 2490s zarr_format, 2490s ) -> None: 2490s """Test opening a specific group within a Zarr store using `open_datatree`.""" 2490s filepath = str(tmpdir / "test.zarr") 2490s group = "/set2" 2490s original_dt = simple_datatree 2490s original_dt.to_zarr( 2490s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 2490s ) 2490s expected_subtree = original_dt[group].copy() 2490s expected_subtree.orphan() 2490s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s __ TestZarrDatatreeIO.test_open_datatree_specific_group[False-zarr_format=3] ___ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr4') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s write_consolidated_metadata = False, zarr_format = 3 2490s 2490s @pytest.mark.filterwarnings( 2490s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 2490s ) 2490s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 2490s def test_open_datatree_specific_group( 2490s self, 2490s tmpdir, 2490s simple_datatree, 2490s write_consolidated_metadata, 2490s zarr_format, 2490s ) -> None: 2490s """Test opening a specific group within a Zarr store using `open_datatree`.""" 2490s filepath = str(tmpdir / "test.zarr") 2490s group = "/set2" 2490s original_dt = simple_datatree 2490s original_dt.to_zarr( 2490s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 2490s ) 2490s expected_subtree = original_dt[group].copy() 2490s expected_subtree.orphan() 2490s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[None-zarr_format=3] ___ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr6') 2490s simple_datatree = 2490s Group: / 2490s │ Dimensions: (y: 3, x: 2) 2490s │ Dimensions without coordinates: y, x 2490s │ Data variables: 2490s ... a (x) int32 8B 2 3 2490s │ │ b (x) float64 16B 0.1 0.2 2490s │ └── Group: /set2/set1 2490s └── Group: /set3 2490s write_consolidated_metadata = None, zarr_format = 3 2490s 2490s @pytest.mark.filterwarnings( 2490s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 2490s ) 2490s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 2490s def test_open_datatree_specific_group( 2490s self, 2490s tmpdir, 2490s simple_datatree, 2490s write_consolidated_metadata, 2490s zarr_format, 2490s ) -> None: 2490s """Test opening a specific group within a Zarr store using `open_datatree`.""" 2490s filepath = str(tmpdir / "test.zarr") 2490s group = "/set2" 2490s original_dt = simple_datatree 2490s original_dt.to_zarr( 2490s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 2490s ) 2490s expected_subtree = original_dt[group].copy() 2490s expected_subtree.orphan() 2490s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 2490s backend_tree = backend.open_datatree( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 2490s groups_dict = self.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s __________ TestZarrDatatreeIO.test_open_groups_chunks[zarr_format=3] ___________ 2490s 2490s self = 2490s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_groups_chunks_zarr_f1') 2490s zarr_format = 3 2490s 2490s @requires_dask 2490s def test_open_groups_chunks(self, tmpdir, zarr_format) -> None: 2490s """Test `open_groups` with chunks on a zarr store.""" 2490s 2490s chunks = {"x": 2, "y": 1} 2490s filepath = str(tmpdir / "test.zarr") 2490s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 2490s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 2490s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 2490s original_tree = DataTree.from_dict( 2490s { 2490s "/": root_data.chunk(chunks), 2490s "/group1": set1_data.chunk(chunks), 2490s "/group2": set2_data.chunk(chunks), 2490s } 2490s ) 2490s original_tree.to_zarr(filepath, mode="w", zarr_format=zarr_format) 2490s 2490s > dict_of_datasets = open_groups(filepath, engine="zarr", chunks=chunks) 2490s 2490s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:752: 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 2490s backend_groups = backend.open_groups_as_dict( 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 2490s group_ds = store_entrypoint.open_dataset( 2490s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 2490s vars, attrs = filename_or_obj.load() 2490s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 2490s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 2490s return Frozen(dict(*args, **kwargs)) 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 2490s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 2490s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2490s 2490s self = , name = 'b' 2490s 2490s def open_store_variable(self, name): 2490s zarr_array = self.members[name] 2490s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 2490s try_nczarr = self._mode == "r" 2490s dimensions, attributes = _get_zarr_dims_and_attrs( 2490s zarr_array, DIMENSION_KEY, try_nczarr 2490s ) 2490s attributes = dict(attributes) 2490s 2490s encoding = { 2490s "chunks": zarr_array.chunks, 2490s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 2490s } 2490s 2490s if _zarr_v3(): 2490s encoding.update( 2490s { 2490s "compressors": zarr_array.compressors, 2490s "filters": zarr_array.filters, 2490s "shards": zarr_array.shards, 2490s } 2490s ) 2490s if self.zarr_group.metadata.zarr_format == 3: 2490s encoding.update({"serializer": zarr_array.serializer}) 2490s else: 2490s encoding.update( 2490s { 2490s "compressor": zarr_array.compressor, 2490s "filters": zarr_array.filters, 2490s } 2490s ) 2490s 2490s if self._use_zarr_fill_value_as_mask: 2490s # Setting this attribute triggers CF decoding for missing values 2490s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 2490s if zarr_array.fill_value is not None: 2490s attributes["_FillValue"] = zarr_array.fill_value 2490s elif "_FillValue" in attributes: 2490s original_zarr_dtype = zarr_array.metadata.data_type 2490s attributes["_FillValue"] = FillValueCoder.decode( 2490s > attributes["_FillValue"], original_zarr_dtype.value 2490s ) 2490s E AttributeError: 'Float64' object has no attribute 'value' 2490s 2490s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 2490s =============================== warnings summary =============================== 2490s tests/test_backends.py: 4 warnings 2490s tests/test_conventions.py: 1 warning 2490s tests/test_rolling.py: 36 warnings 2490s /usr/lib/python3/dist-packages/xarray/core/duck_array_ops.py:237: RuntimeWarning: invalid value encountered in cast 2490s return data.astype(dtype, **kwargs) 2490s 2490s tests/test_backends.py: 540 warnings 2490s tests/test_backends_datatree.py: 15 warnings 2490s /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. 2490s warnings.warn( 2490s 2490s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 2490s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 2490s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends.py: 117 warnings 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 2490s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 2490s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends.py: 12 warnings 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 2490s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 2490s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends.py: 33 warnings 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends.py: 33 warnings 2490s /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. 2490s v3_unstable_dtype_warning(self) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 2490s /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. 2490s super().__init__(**codec_config) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 2490s /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. 2490s super().__init__(**codec_config) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: '.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: '.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/.zarray' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/.zarray' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/.zarray' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/.zarray' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/.zarray' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/.zarray' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/.zgroup' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/.zattrs' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/zarr.json' 2490s return self._open_to_write(zinfo, force_zip64=force_zip64) 2490s 2490s tests/test_dask.py: 12 warnings 2490s tests/test_units.py: 10 warnings 2490s /usr/lib/python3/dist-packages/numpy/_core/numeric.py:476: RuntimeWarning: invalid value encountered in cast 2490s multiarray.copyto(res, fill_value, casting='unsafe') 2490s 2490s tests/test_duck_array_ops.py::test_cftime_datetime_mean[True] 2490s /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. 2490s result = function(*args, **kwargs) 2490s 2490s tests/test_duck_array_wrapping.py::TestDataArrayMethods::test_astype[pint] 2490s /usr/lib/python3/dist-packages/pint/facets/numpy/quantity.py:88: RuntimeWarning: invalid value encountered in cast 2490s value = func(*args, **kwargs) 2490s 2490s tests/test_tutorial.py::TestLoadDataset::test_download_from_github 2490s /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='dbd0f748-3515-4faa-a176-b66a41450ac0'), but file is not already closed. This may indicate a bug. 2490s result = testfunction(**testargs) 2490s 2490s tests/test_tutorial.py::TestLoadDataset::test_download_from_github_load_without_cache 2490s /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='7ea7a35a-58b9-4b1b-94ce-239de6778948'), but file is not already closed. This may indicate a bug. 2490s result = testfunction(**testargs) 2490s 2490s tests/test_tutorial.py::TestLoadDataset::test_download_from_github_load_without_cache 2490s /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='9f494833-fd8b-40bf-9484-afe93521b0bd'), but file is not already closed. This may indicate a bug. 2490s result = testfunction(**testargs) 2490s 2490s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-compatible_unit-function_clip] 2490s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-identical_unit-function_clip] 2490s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int32-compatible_unit-function_clip] 2490s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int32-identical_unit-function_clip] 2490s /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) 2490s return conv.wrap(result, to_scalar=False) 2490s 2490s tests/test_units.py::TestDataArray::test_missing_value_filling[int32-method_ffill] 2490s tests/test_units.py::TestDataArray::test_missing_value_filling[int32-method_bfill] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2766: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py: 15 warnings 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2803: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataArray::test_dropna[int32] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2831: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataArray::test_isin[int32-no_unit] 2490s tests/test_units.py::TestDataArray::test_isin[int32-dimensionless] 2490s tests/test_units.py::TestDataArray::test_isin[int32-incompatible_unit] 2490s tests/test_units.py::TestDataArray::test_isin[int32-compatible_unit] 2490s tests/test_units.py::TestDataArray::test_isin[int32-identical_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2856: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataArray::test_isin[int32-no_unit] 2490s tests/test_units.py::TestDataArray::test_isin[int32-dimensionless] 2490s tests/test_units.py::TestDataArray::test_isin[int32-incompatible_unit] 2490s tests/test_units.py::TestDataArray::test_isin[int32-compatible_unit] 2490s tests/test_units.py::TestDataArray::test_isin[int32-identical_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2861: RuntimeWarning: invalid value encountered in cast 2490s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_ffill] 2490s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_bfill] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4252: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_ffill] 2490s tests/test_units.py::TestDataset::test_missing_value_filling[int32-method_bfill] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4256: RuntimeWarning: invalid value encountered in cast 2490s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 2490s 2490s tests/test_units.py: 15 warnings 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4295: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py: 15 warnings 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4299: RuntimeWarning: invalid value encountered in cast 2490s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_dropna[int32] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4325: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_dropna[int32] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4329: RuntimeWarning: invalid value encountered in cast 2490s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_isin[int32-no_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-dimensionless] 2490s tests/test_units.py::TestDataset::test_isin[int32-incompatible_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-compatible_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-same_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4353: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_isin[int32-no_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-dimensionless] 2490s tests/test_units.py::TestDataset::test_isin[int32-incompatible_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-compatible_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-same_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4357: RuntimeWarning: invalid value encountered in cast 2490s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_isin[int32-no_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-dimensionless] 2490s tests/test_units.py::TestDataset::test_isin[int32-incompatible_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-compatible_unit] 2490s tests/test_units.py::TestDataset::test_isin[int32-same_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4362: RuntimeWarning: invalid value encountered in cast 2490s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_interpolate_na[int32] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4438: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_interpolate_na[int32] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4442: RuntimeWarning: invalid value encountered in cast 2490s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 2490s 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-no_unit] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-dimensionless] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-incompatible_unit] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-compatible_unit] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-same_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4487: RuntimeWarning: invalid value encountered in cast 2490s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) * data_unit 2490s 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-no_unit] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-dimensionless] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-incompatible_unit] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-compatible_unit] 2490s tests/test_units.py::TestDataset::test_combine_first[int32-data-same_unit] 2490s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4490: RuntimeWarning: invalid value encountered in cast 2490s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) * data_unit 2490s 2490s tests/test_variable.py::TestIndexVariable::test_to_index_multiindex_level 2490s /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)`. 2490s ds = Dataset(coords={"x": midx}) 2490s 2490s tests/test_weighted.py::test_weighted_quantile_3D[None-True-q1-a] 2490s tests/test_weighted.py::test_weighted_quantile_3D[True-True-0.5-a] 2490s /usr/lib/python3/dist-packages/numpy/lib/_nanfunctions_impl.py:1617: RuntimeWarning: All-NaN slice encountered 2490s return fnb._ureduce(a, 2490s 2490s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 2490s =========================== short test summary info ============================ 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_store[3] - Attri... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_load[3] - AttributeErr... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - A... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - At... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_dropna[3] - AttributeE... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_bytes_with_fill_value[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - At... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_overwrite_values[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - Attrib... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - Attr... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - At... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - At... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_group[3] - AttributeEr... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_write[3] - Attr... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_not_set_raises[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - A... 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 2490s FAILED tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_store[3] - ... 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_test_data[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_load[3] - Attribu... 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dataset_compute[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_object_dtype[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_float64_data[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_orthogonal_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing_negative_step[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_outer_indexing_reversed[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_isel_dataarray[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_array_type_after_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dropna[3] - Attri... 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_ondisk_after_print[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_bytes_with_fill_value[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value0-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value1-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3--1-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-255-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_coordinate_variables_after_dataset_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_kwarg[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_default_fill_value[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_same_dtype[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_overwrite_values[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_read_non_consolidated_warning[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_auto_chunk[3] - A... 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_manual_chunk[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_warning_on_bad_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_uneven_dask_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_shard_encoding[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-group1] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_compressor_encoding[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_group[3] - Attrib... 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_write[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_not_set_raises[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-U] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-S] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_check_encoding_is_consistent_after_append[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_new_variable[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_no_overwrite[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_compute_false_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_append_compute_false_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_no_warning_from_open_emptydim_with_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-None] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-r+] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-a] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_preexisting_override_metadata[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_chunksizes[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding_with_partial_dask_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_open_zarr_use_cftime[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_read_select_write[3] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_attributes[3-obj1] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 2490s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zarr_fill_value_setting[3-float] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_store[3] - Attr... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_test_data[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_load[3] - AttributeEr... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dataset_compute[3] - ... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_object_dtype[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_float64_data[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_orthogonal_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing_negative_step[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_outer_indexing_reversed[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_isel_dataarray[3] - A... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_array_type_after_indexing[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dropna[3] - Attribute... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_ondisk_after_print[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_bytes_with_fill_value[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value0-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value1-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3--1-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-255-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_coordinate_variables_after_dataset_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_kwarg[3] - A... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_default_fill_value[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_same_dtype[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_overwrite_values[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_read_non_consolidated_warning[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_auto_chunk[3] - Attri... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_manual_chunk[3] - Att... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_warning_on_bad_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_uneven_dask_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding[3] - A... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_shard_encoding[3] - A... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-group1] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_compressor_encoding[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_group[3] - AttributeE... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_write[3] - Att... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_not_set_raises[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-U] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-S] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_check_encoding_is_consistent_after_append[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_new_variable[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_no_overwrite[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_compute_false_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_append_compute_false_roundtrip[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_no_warning_from_open_emptydim_with_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-r+] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-a] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_preexisting_override_metadata[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_chunksizes[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding_with_partial_dask_chunks[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_open_zarr_use_cftime[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_read_select_write[3] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_attributes[3-obj1] - ... 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zarr_fill_value_setting[3-float] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-None] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-True] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-False] 2490s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-None] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-full-auto] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-mixed-auto] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_index_write[3] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region[3] - Attr... 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_append_chunk_partial[3] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_chunk_partial_offset[3] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_append_dim[3] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-r+] 2490s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-a] 2490s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[auto] - Attrib... 2490s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[-1] - Attribut... 2490s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks2] - Att... 2490s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks3] - Att... 2490s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks4] - Att... 2490s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks5] - Att... 2490s FAILED tests/test_backends.py::test_chunking_consintency[auto] - AttributeErr... 2490s FAILED tests/test_backends.py::test_chunking_consintency[-1] - AttributeError... 2490s FAILED tests/test_backends.py::test_chunking_consintency[chunks2] - Attribute... 2490s FAILED tests/test_backends.py::test_chunking_consintency[chunks3] - Attribute... 2490s FAILED tests/test_backends.py::test_chunking_consintency[chunks4] - Attribute... 2490s FAILED tests/test_backends.py::test_chunking_consintency[chunks5] - Attribute... 2490s FAILED tests/test_backends.py::TestNCZarr::test_overwriting_nczarr - Attribut... 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_not_consolidated[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_round_trip[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_chunks[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups[zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[True-zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[False-zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[None-zarr_format=3] 2490s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_chunks[zarr_format=3] 2490s = 362 failed, 19223 passed, 1887 skipped, 62 deselected, 243 xfailed, 115 xpassed, 966 warnings in 933.13s (0:15:33) = 2493s E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /tmp/autopkgtest.VI88X3/autopkgtest_tmp/build; python3.13 -m pytest --deselect=tests/test_cftimeindex.py::test_asi8 --deselect=tests/test_datatree.py::TestRepr::test_doc_example --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 --deselect=tests/test_strategies.py::TestReduction::test_mean 2493s pybuild-autopkgtest: error: pybuild --autopkgtest --test-pytest -i python{version} -p "3.14 3.13" returned exit code 13 2493s make: *** [/tmp/xWU3f6_AEu/run:4: pybuild-autopkgtest] Error 25 2493s pybuild-autopkgtest: error: /tmp/xWU3f6_AEu/run pybuild-autopkgtest returned exit code 2 2494s autopkgtest [11:07:02]: test pybuild-autopkgtest: -----------------------] 2498s autopkgtest [11:07:06]: test pybuild-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 2498s pybuild-autopkgtest FAIL non-zero exit status 25 2501s autopkgtest [11:07:09]: @@@@@@@@@@@@@@@@@@@@ summary 2501s pybuild-autopkgtest FAIL non-zero exit status 25