0s autopkgtest [10:58:10]: starting date and time: 2025-11-17 10:58:10+0000 0s autopkgtest [10:58:10]: git checkout: 4b346b80 nova: make wait_reboot return success even when a no-op 1s autopkgtest [10:58:10]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.49pb99mx/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:numpy,src:python3-defaults --apt-upgrade python-xarray --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 '--env=ADT_TEST_TRIGGERS=numpy/1:2.3.4+ds-3ubuntu1 python3-defaults/3.13.7-2' -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-s390x --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@bos03-s390x-7.secgroup --name adt-resolute-s390x-python-xarray-20251117-105810-juju-7f2275-prod-proposed-migration-environment-20-099bfdcb-0427-4f88-a031-3653156848cb --image adt/ubuntu-resolute-s390x-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-proposed-migration-s390x -e TERM=linux --mirror=http://ftpmaster.internal/ubuntu/ 4s Creating nova instance adt-resolute-s390x-python-xarray-20251117-105810-juju-7f2275-prod-proposed-migration-environment-20-099bfdcb-0427-4f88-a031-3653156848cb from image adt/ubuntu-resolute-s390x-server-20251117.img (UUID a3a3e3b9-e6ba-478c-a5e9-fce6f0982a95)... 83s autopkgtest [10:59:33]: testbed dpkg architecture: s390x 84s autopkgtest [10:59:34]: testbed apt version: 3.1.11 84s autopkgtest [10:59:34]: @@@@@@@@@@@@@@@@@@@@ test bed setup 84s autopkgtest [10:59:34]: testbed release detected to be: None 85s autopkgtest [10:59:35]: updating testbed package index (apt update) 85s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [87.8 kB] 85s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 85s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 85s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 86s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [868 kB] 86s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [81.1 kB] 86s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [22.9 kB] 86s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/restricted Sources [9848 B] 86s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x Packages [138 kB] 86s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/restricted s390x Packages [940 B] 86s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/universe s390x Packages [545 kB] 86s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse s390x Packages [10.6 kB] 86s Fetched 1764 kB in 1s (1697 kB/s) 87s Reading package lists... 87s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 87s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 88s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 88s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 88s Reading package lists... 88s Reading package lists... 88s Building dependency tree... 88s Reading state information... 88s Calculating upgrade... 89s The following packages will be upgraded: 89s libpython3-stdlib python3 python3-minimal usbutils 89s 4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 89s Need to get 148 kB of archives. 89s After this operation, 4096 B disk space will be freed. 89s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x python3-minimal s390x 3.13.7-2 [27.8 kB] 89s Get:2 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x python3 s390x 3.13.7-2 [23.9 kB] 89s Get:3 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x libpython3-stdlib s390x 3.13.7-2 [10.6 kB] 89s Get:4 http://ftpmaster.internal/ubuntu resolute/main s390x usbutils s390x 1:019-1 [85.6 kB] 89s dpkg-preconfigure: unable to re-open stdin: No such file or directory 89s Fetched 148 kB in 0s (348 kB/s) 89s (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 ... 61309 files and directories currently installed.) 89s Preparing to unpack .../python3-minimal_3.13.7-2_s390x.deb ... 89s Unpacking python3-minimal (3.13.7-2) over (3.13.7-1) ... 89s Setting up python3-minimal (3.13.7-2) ... 90s (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 ... 61309 files and directories currently installed.) 90s Preparing to unpack .../python3_3.13.7-2_s390x.deb ... 90s running python pre-rtupdate hooks for python3.13... 90s Unpacking python3 (3.13.7-2) over (3.13.7-1) ... 90s Preparing to unpack .../libpython3-stdlib_3.13.7-2_s390x.deb ... 90s Unpacking libpython3-stdlib:s390x (3.13.7-2) over (3.13.7-1) ... 90s Preparing to unpack .../usbutils_1%3a019-1_s390x.deb ... 90s Unpacking usbutils (1:019-1) over (1:018-2) ... 90s Setting up usbutils (1:019-1) ... 90s Setting up libpython3-stdlib:s390x (3.13.7-2) ... 90s Setting up python3 (3.13.7-2) ... 90s running python rtupdate hooks for python3.13... 90s running python post-rtupdate hooks for python3.13... 90s Processing triggers for man-db (2.13.1-1) ... 91s autopkgtest [10:59:41]: upgrading testbed (apt dist-upgrade and autopurge) 91s Reading package lists... 91s Building dependency tree... 91s Reading state information... 91s Calculating upgrade... 91s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 92s Reading package lists... 92s Building dependency tree... 92s Reading state information... 92s Solving dependencies... 92s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 95s autopkgtest [10:59:45]: testbed running kernel: Linux 6.17.0-5-generic #5-Ubuntu SMP Mon Sep 22 08:56:47 UTC 2025 95s autopkgtest [10:59:45]: @@@@@@@@@@@@@@@@@@@@ apt-source python-xarray 97s Get:1 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (dsc) [3963 B] 97s Get:2 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (tar) [2781 kB] 97s Get:3 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (diff) [20.6 kB] 97s gpgv: Signature made Mon May 5 11:14:20 2025 UTC 97s gpgv: using RSA key 7E1AC3FA27A649284C323EF6695C429316C07BFE 97s gpgv: issuer "jdg@debian.org" 97s gpgv: Can't check signature: No public key 97s dpkg-source: warning: cannot verify inline signature for ./python-xarray_2025.03.1-8.dsc: no acceptable signature found 97s autopkgtest [10:59:47]: testing package python-xarray version 2025.03.1-8 98s autopkgtest [10:59:48]: build not needed 102s autopkgtest [10:59:52]: test pybuild-autopkgtest: preparing testbed 102s Reading package lists... 102s Building dependency tree... 102s Reading state information... 102s Solving dependencies... 102s The following NEW packages will be installed: 102s autoconf automake autopoint autotools-dev blt build-essential cpp cpp-15 102s cpp-15-s390x-linux-gnu cpp-s390x-linux-gnu debhelper debugedit dh-autoreconf 102s dh-python dh-strip-nondeterminism docutils-common dwz fontconfig-config 102s fonts-dejavu-core fonts-dejavu-mono fonts-font-awesome fonts-lato fonts-lyx 102s fonts-mathjax fonts-open-sans g++ g++-15 g++-15-s390x-linux-gnu 102s g++-s390x-linux-gnu gcc gcc-15 gcc-15-s390x-linux-gnu gcc-s390x-linux-gnu 102s gdb gettext intltool-debian ipython3 libaec0 libarchive-zip-perl libasan8 102s libbabeltrace1 libblas3 libblosc1 libcares2 libcc1-0 libdebhelper-perl 102s libdeflate0 libfile-stripnondeterminism-perl libfontconfig1 libfreetype6 102s libgcc-15-dev libgeos-c1t64 libgeos3.13.1 libgfortran5 libgomp1 102s libgraphite2-3 libharfbuzz0b libhdf5-310 libhdf5-hl-310 libimagequant0 102s libisl23 libitm1 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-mathjax 102s libjs-requirejs libjs-sphinxdoc libjs-sprintf-js libjs-underscore 102s libjson-perl liblapack3 liblcms2-2 liblua5.4-0 liblzf1 libmpc3 libnetcdf22 102s libnode115 libnorm1t64 libopenjp2-7 libpgm-5.3-0t64 libproj25 102s libpython3.14-minimal libpython3.14-stdlib libqhull-r8.0 libraqm0 102s libsharpyuv0 libsnappy1v5 libsodium23 libsource-highlight-common 102s libsource-highlight4t64 libstdc++-15-dev libsz2 libtcl8.6 libtiff6 libtk8.6 102s libtool libubsan1 libwebp7 libwebpdemux2 libwebpmux3 libxft2 libxrender1 102s libxslt1.1 libxss1 libzmq5 libzopfli1 m4 mypy node-acorn node-argparse 102s node-balanced-match node-brace-expansion node-cjs-module-lexer node-corepack 102s node-debug node-esprima node-fortawesome-fontawesome-free node-js-yaml 102s node-llhttp node-lru-cache node-minimatch node-ms node-semver 102s node-sprintf-js node-undici node-xtend nodejs pandoc pandoc-data po-debconf 102s proj-data pybuild-plugin-autopkgtest pybuild-plugin-pyproject 102s python-cartopy-data python-dask-doc python-hypothesis-doc 102s python-matplotlib-data python-pandas-doc python-scipy-doc 102s python-tinycss2-common python-xarray-doc python3-accessible-pygments 102s python3-alabaster python3-all python3-asttokens python3-autodocsumm 102s python3-bleach python3-bottleneck python3-brotli python3-bs4 python3-build 102s python3-cartopy python3-cftime python3-click python3-cloudpickle 102s python3-comm python3-contourpy python3-coverage python3-crc32c 102s python3-cycler python3-dask python3-debugpy python3-decorator 102s python3-defusedxml python3-doc python3-docutils python3-donfig 102s python3-execnet python3-executing python3-fastjsonschema python3-flexcache 102s python3-flexparser python3-fonttools python3-fs python3-fsspec 102s python3-h5netcdf python3-h5py python3-h5py-serial python3-html5lib 102s python3-hypothesis python3-imagesize python3-iniconfig python3-installer 102s python3-ipykernel python3-ipython python3-jedi python3-jupyter-client 102s python3-jupyter-console python3-jupyter-core python3-jupyterlab-pygments 102s python3-kiwisolver python3-locket python3-lxml python3-lz4 102s python3-matplotlib python3-matplotlib-inline python3-mistune python3-mpmath 102s python3-mypy python3-mypy-extensions python3-nbclient python3-nbconvert 102s python3-nbformat python3-nbsphinx python3-nest-asyncio python3-netcdf4 102s python3-numcodecs python3-numpy python3-numpy-dev python3-numpydoc 102s python3-pandas python3-pandas-lib python3-pandocfilters python3-parso 102s python3-partd python3-pickleshare python3-pil python3-pil.imagetk 102s python3-pint python3-pip python3-platformdirs python3-pluggy python3-pooch 102s python3-prompt-toolkit python3-psutil python3-pure-eval 102s python3-pydata-sphinx-theme python3-pyproj python3-pyproject-hooks 102s python3-pyshp python3-pytest python3-pytest-mypy python3-pytest-xdist 102s python3-pytz python3-regex python3-roman python3-scipy python3-seaborn 102s python3-setuptools-scm python3-shapely python3-snowballstemmer 102s python3-sortedcontainers python3-soupsieve python3-sphinx 102s python3-sphinx-book-theme python3-sphinx-copybutton python3-sphinx-design 102s python3-sphinx-gallery python3-sphinx-inline-tabs 102s python3-sphinx-remove-toctrees python3-sphinx-rtd-theme 102s python3-sphinxcontrib-mermaid python3-sphinxcontrib.jquery 102s python3-sphinxext-opengraph python3-sphinxext-rediraffe python3-stack-data 102s python3-sympy python3-tinycss2 python3-tk python3-tomlkit python3-toolz 102s python3-tornado python3-traitlets python3-typeshed python3-ufolib2 102s python3-wcwidth python3-webencodings python3-wheel python3-xarray 102s python3-zarr python3-zmq python3-zopfli python3.13-doc python3.13-tk 102s python3.14 python3.14-minimal python3.14-tk sgml-base sphinx-common 102s sphinx-rtd-theme-common tk8.6-blt2.5 tzdata-legacy unicode-data x11-common 102s xml-core 103s 0 upgraded, 287 newly installed, 0 to remove and 0 not upgraded. 103s Need to get 344 MB of archives. 103s After this operation, 1780 MB of additional disk space will be used. 103s Get:1 http://ftpmaster.internal/ubuntu resolute/main s390x fonts-lato all 2.015-1 [2781 kB] 103s Get:2 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x python3-numpy-dev s390x 1:2.3.4+ds-3ubuntu1 [146 kB] 103s Get:3 http://ftpmaster.internal/ubuntu resolute/main s390x libblas3 s390x 3.12.1-7 [254 kB] 103s Get:4 http://ftpmaster.internal/ubuntu resolute/main s390x libgfortran5 s390x 15.2.0-7ubuntu1 [629 kB] 103s Get:5 http://ftpmaster.internal/ubuntu resolute/main s390x liblapack3 s390x 3.12.1-7 [2983 kB] 103s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x python3-numpy s390x 1:2.3.4+ds-3ubuntu1 [5302 kB] 104s Get:7 http://ftpmaster.internal/ubuntu resolute/main s390x libpython3.14-minimal s390x 3.14.0-4 [904 kB] 104s Get:8 http://ftpmaster.internal/ubuntu resolute/main s390x python3.14-minimal s390x 3.14.0-4 [2509 kB] 104s Get:9 http://ftpmaster.internal/ubuntu resolute/main s390x m4 s390x 1.4.20-2 [223 kB] 104s Get:10 http://ftpmaster.internal/ubuntu resolute/main s390x autoconf all 2.72-3.1ubuntu1 [384 kB] 104s Get:11 http://ftpmaster.internal/ubuntu resolute/main s390x autotools-dev all 20240727.1 [43.4 kB] 104s Get:12 http://ftpmaster.internal/ubuntu resolute/main s390x automake all 1:1.18.1-2 [581 kB] 104s Get:13 http://ftpmaster.internal/ubuntu resolute/main s390x autopoint all 0.23.2-1 [620 kB] 104s Get:14 http://ftpmaster.internal/ubuntu resolute/main s390x libtcl8.6 s390x 8.6.17+dfsg-1 [1034 kB] 104s Get:15 http://ftpmaster.internal/ubuntu resolute/main s390x libfreetype6 s390x 2.13.3+dfsg-1build1 [430 kB] 104s Get:16 http://ftpmaster.internal/ubuntu resolute/main s390x fonts-dejavu-mono all 2.37-8 [502 kB] 104s Get:17 http://ftpmaster.internal/ubuntu resolute/main s390x fonts-dejavu-core all 2.37-8 [835 kB] 104s Get:18 http://ftpmaster.internal/ubuntu resolute/main s390x fontconfig-config s390x 2.15.0-2.3ubuntu1 [38.1 kB] 104s Get:19 http://ftpmaster.internal/ubuntu resolute/main s390x libfontconfig1 s390x 2.15.0-2.3ubuntu1 [149 kB] 104s Get:20 http://ftpmaster.internal/ubuntu resolute/main s390x libxrender1 s390x 1:0.9.12-1 [20.9 kB] 104s Get:21 http://ftpmaster.internal/ubuntu resolute/main s390x libxft2 s390x 2.3.6-1build1 [49.6 kB] 104s Get:22 http://ftpmaster.internal/ubuntu resolute/main s390x x11-common all 1:7.7+24ubuntu1 [22.4 kB] 104s Get:23 http://ftpmaster.internal/ubuntu resolute/main s390x libxss1 s390x 1:1.2.3-1build3 [7396 B] 104s Get:24 http://ftpmaster.internal/ubuntu resolute/main s390x libtk8.6 s390x 8.6.17-1 [828 kB] 104s Get:25 http://ftpmaster.internal/ubuntu resolute/main s390x tk8.6-blt2.5 s390x 2.5.3+dfsg-8 [657 kB] 104s Get:26 http://ftpmaster.internal/ubuntu resolute/main s390x blt s390x 2.5.3+dfsg-8 [4826 B] 104s Get:27 http://ftpmaster.internal/ubuntu resolute/main s390x libisl23 s390x 0.27-1 [704 kB] 104s Get:28 http://ftpmaster.internal/ubuntu resolute/main s390x libmpc3 s390x 1.3.1-2 [57.4 kB] 104s Get:29 http://ftpmaster.internal/ubuntu resolute/main s390x cpp-15-s390x-linux-gnu s390x 15.2.0-7ubuntu1 [10.2 MB] 104s Get:30 http://ftpmaster.internal/ubuntu resolute/main s390x cpp-15 s390x 15.2.0-7ubuntu1 [1022 B] 104s Get:31 http://ftpmaster.internal/ubuntu resolute/main s390x cpp-s390x-linux-gnu s390x 4:15.2.0-4ubuntu1 [5746 B] 104s Get:32 http://ftpmaster.internal/ubuntu resolute/main s390x cpp s390x 4:15.2.0-4ubuntu1 [22.4 kB] 104s Get:33 http://ftpmaster.internal/ubuntu resolute/main s390x libcc1-0 s390x 15.2.0-7ubuntu1 [50.0 kB] 104s Get:34 http://ftpmaster.internal/ubuntu resolute/main s390x libgomp1 s390x 15.2.0-7ubuntu1 [154 kB] 104s Get:35 http://ftpmaster.internal/ubuntu resolute/main s390x libitm1 s390x 15.2.0-7ubuntu1 [30.9 kB] 104s Get:36 http://ftpmaster.internal/ubuntu resolute/main s390x libasan8 s390x 15.2.0-7ubuntu1 [2968 kB] 104s Get:37 http://ftpmaster.internal/ubuntu resolute/main s390x libubsan1 s390x 15.2.0-7ubuntu1 [1211 kB] 104s Get:38 http://ftpmaster.internal/ubuntu resolute/main s390x libgcc-15-dev s390x 15.2.0-7ubuntu1 [1045 kB] 104s Get:39 http://ftpmaster.internal/ubuntu resolute/main s390x gcc-15-s390x-linux-gnu s390x 15.2.0-7ubuntu1 [19.9 MB] 105s Get:40 http://ftpmaster.internal/ubuntu resolute/main s390x gcc-15 s390x 15.2.0-7ubuntu1 [513 kB] 105s Get:41 http://ftpmaster.internal/ubuntu resolute/main s390x gcc-s390x-linux-gnu s390x 4:15.2.0-4ubuntu1 [1208 B] 105s Get:42 http://ftpmaster.internal/ubuntu resolute/main s390x gcc s390x 4:15.2.0-4ubuntu1 [5018 B] 105s Get:43 http://ftpmaster.internal/ubuntu resolute/main s390x libstdc++-15-dev s390x 15.2.0-7ubuntu1 [2659 kB] 105s Get:44 http://ftpmaster.internal/ubuntu resolute/main s390x g++-15-s390x-linux-gnu s390x 15.2.0-7ubuntu1 [11.7 MB] 105s Get:45 http://ftpmaster.internal/ubuntu resolute/main s390x g++-15 s390x 15.2.0-7ubuntu1 [23.7 kB] 105s Get:46 http://ftpmaster.internal/ubuntu resolute/main s390x g++-s390x-linux-gnu s390x 4:15.2.0-4ubuntu1 [956 B] 105s Get:47 http://ftpmaster.internal/ubuntu resolute/main s390x g++ s390x 4:15.2.0-4ubuntu1 [1078 B] 105s Get:48 http://ftpmaster.internal/ubuntu resolute/main s390x build-essential s390x 12.12ubuntu1 [5090 B] 105s Get:49 http://ftpmaster.internal/ubuntu resolute/main s390x libdebhelper-perl all 13.24.2ubuntu1 [95.7 kB] 105s Get:50 http://ftpmaster.internal/ubuntu resolute/main s390x libtool all 2.5.4-7 [169 kB] 105s Get:51 http://ftpmaster.internal/ubuntu resolute/main s390x dh-autoreconf all 21 [12.5 kB] 105s Get:52 http://ftpmaster.internal/ubuntu resolute/main s390x libarchive-zip-perl all 1.68-1 [90.2 kB] 105s Get:53 http://ftpmaster.internal/ubuntu resolute/main s390x libfile-stripnondeterminism-perl all 1.15.0-1 [20.5 kB] 105s Get:54 http://ftpmaster.internal/ubuntu resolute/main s390x dh-strip-nondeterminism all 1.15.0-1 [5090 B] 105s Get:55 http://ftpmaster.internal/ubuntu resolute/main s390x debugedit s390x 1:5.2-3 [52.8 kB] 105s Get:56 http://ftpmaster.internal/ubuntu resolute/main s390x dwz s390x 0.16-2 [121 kB] 105s Get:57 http://ftpmaster.internal/ubuntu resolute/main s390x gettext s390x 0.23.2-1 [1062 kB] 105s Get:58 http://ftpmaster.internal/ubuntu resolute/main s390x intltool-debian all 0.35.0+20060710.6 [23.2 kB] 105s Get:59 http://ftpmaster.internal/ubuntu resolute/main s390x po-debconf all 1.0.21+nmu1 [233 kB] 105s Get:60 http://ftpmaster.internal/ubuntu resolute/main s390x debhelper all 13.24.2ubuntu1 [896 kB] 105s Get:61 http://ftpmaster.internal/ubuntu resolute/universe s390x dh-python all 6.20250414 [119 kB] 105s Get:62 http://ftpmaster.internal/ubuntu resolute/main s390x sgml-base all 1.31+nmu1 [11.0 kB] 105s Get:63 http://ftpmaster.internal/ubuntu resolute/main s390x xml-core all 0.19 [20.3 kB] 105s Get:64 http://ftpmaster.internal/ubuntu resolute/main s390x docutils-common all 0.21.2+dfsg-2 [131 kB] 105s Get:65 http://ftpmaster.internal/ubuntu resolute/main s390x fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 105s Get:66 http://ftpmaster.internal/ubuntu resolute/universe s390x fonts-lyx all 2.4.4-2 [171 kB] 105s Get:67 http://ftpmaster.internal/ubuntu resolute/main s390x fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 105s Get:68 http://ftpmaster.internal/ubuntu resolute/universe s390x fonts-open-sans all 1.11-2 [635 kB] 105s Get:69 http://ftpmaster.internal/ubuntu resolute/main s390x libbabeltrace1 s390x 1.5.11-4build3 [170 kB] 105s Get:70 http://ftpmaster.internal/ubuntu resolute/main s390x libsource-highlight-common all 3.1.9-4.3build1 [64.2 kB] 105s Get:71 http://ftpmaster.internal/ubuntu resolute/main s390x libsource-highlight4t64 s390x 3.1.9-4.3build1 [268 kB] 105s Get:72 http://ftpmaster.internal/ubuntu resolute/main s390x gdb s390x 16.3-1ubuntu2 [3942 kB] 105s Get:73 http://ftpmaster.internal/ubuntu resolute/main s390x python3-decorator all 5.2.1-2 [28.1 kB] 105s Get:74 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-parso all 0.8.5-1 [68.0 kB] 105s Get:75 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-typeshed all 0.0~git20241223.ea91db2-4 [1554 kB] 106s Get:76 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-jedi all 0.19.1+ds1-1 [693 kB] 106s Get:77 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-traitlets all 5.14.3+really5.14.3-1 [71.5 kB] 106s Get:78 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-matplotlib-inline all 0.1.7-1 [9186 B] 106s Get:79 http://ftpmaster.internal/ubuntu resolute/main s390x python3-wcwidth all 0.2.13+dfsg1-1 [26.3 kB] 106s Get:80 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-prompt-toolkit all 3.0.52-1 [258 kB] 106s Get:81 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-asttokens all 3.0.0-2 [20.5 kB] 106s Get:82 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-executing all 2.2.0-0.2 [25.0 kB] 106s Get:83 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pure-eval all 0.2.3-1 [11.4 kB] 106s Get:84 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-stack-data all 0.6.3-1 [22.0 kB] 106s Get:85 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-ipython all 8.35.0-2 [575 kB] 106s Get:86 http://ftpmaster.internal/ubuntu resolute/universe s390x ipython3 all 8.35.0-2 [4908 B] 106s Get:87 http://ftpmaster.internal/ubuntu resolute/universe s390x libaec0 s390x 1.1.4-2 [26.1 kB] 106s Get:88 http://ftpmaster.internal/ubuntu resolute/main s390x libsnappy1v5 s390x 1.2.2-2 [33.0 kB] 106s Get:89 http://ftpmaster.internal/ubuntu resolute/universe s390x libblosc1 s390x 1.21.5+ds-2 [27.9 kB] 106s Get:90 http://ftpmaster.internal/ubuntu resolute/main s390x libcares2 s390x 1.34.5-1 [102 kB] 106s Get:91 http://ftpmaster.internal/ubuntu resolute/main s390x libdeflate0 s390x 1.23-2 [46.0 kB] 106s Get:92 http://ftpmaster.internal/ubuntu resolute/universe s390x libgeos3.13.1 s390x 3.13.1-1 [963 kB] 106s Get:93 http://ftpmaster.internal/ubuntu resolute/universe s390x libgeos-c1t64 s390x 3.13.1-1 [93.0 kB] 106s Get:94 http://ftpmaster.internal/ubuntu resolute/main s390x libgraphite2-3 s390x 1.3.14-2ubuntu1 [79.8 kB] 106s Get:95 http://ftpmaster.internal/ubuntu resolute/main s390x libharfbuzz0b s390x 12.1.0-1 [576 kB] 106s Get:96 http://ftpmaster.internal/ubuntu resolute/universe s390x libsz2 s390x 1.1.4-2 [5628 B] 106s Get:97 http://ftpmaster.internal/ubuntu resolute/universe s390x libhdf5-310 s390x 1.14.5+repack-4 [1472 kB] 106s Get:98 http://ftpmaster.internal/ubuntu resolute/universe s390x libhdf5-hl-310 s390x 1.14.5+repack-4 [60.9 kB] 106s Get:99 http://ftpmaster.internal/ubuntu resolute/main s390x libimagequant0 s390x 2.18.0-1build1 [43.3 kB] 106s Get:100 http://ftpmaster.internal/ubuntu resolute/main s390x libjpeg-turbo8 s390x 2.1.5-4ubuntu2 [147 kB] 106s Get:101 http://ftpmaster.internal/ubuntu resolute/main s390x libjpeg8 s390x 8c-2ubuntu11 [2146 B] 106s Get:102 http://ftpmaster.internal/ubuntu resolute/main s390x libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 106s Get:103 http://ftpmaster.internal/ubuntu resolute/main s390x libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 106s Get:104 http://ftpmaster.internal/ubuntu resolute/main s390x libjs-sphinxdoc all 8.2.3-1ubuntu2 [28.0 kB] 106s Get:105 http://ftpmaster.internal/ubuntu resolute/universe s390x libjs-sprintf-js all 1.1.2+ds1+~1.1.2-1 [12.8 kB] 106s Get:106 http://ftpmaster.internal/ubuntu resolute/main s390x libjson-perl all 4.10000-1 [81.9 kB] 106s Get:107 http://ftpmaster.internal/ubuntu resolute/main s390x liblcms2-2 s390x 2.17-1 [176 kB] 106s Get:108 http://ftpmaster.internal/ubuntu resolute/main s390x liblua5.4-0 s390x 5.4.8-1 [173 kB] 106s Get:109 http://ftpmaster.internal/ubuntu resolute/universe s390x liblzf1 s390x 3.6-4 [7020 B] 106s Get:110 http://ftpmaster.internal/ubuntu resolute/universe s390x libnetcdf22 s390x 1:4.9.3-1build1 [583 kB] 107s Get:111 http://ftpmaster.internal/ubuntu resolute/universe s390x node-xtend all 4.0.2-3 [3902 B] 107s Get:112 http://ftpmaster.internal/ubuntu resolute/universe s390x node-corepack all 0.24.0-5 [757 kB] 107s Get:113 http://ftpmaster.internal/ubuntu resolute/universe s390x nodejs s390x 20.19.4+dfsg-1 [342 kB] 107s Get:114 http://ftpmaster.internal/ubuntu resolute/universe s390x node-acorn all 8.8.1+ds+~cs25.17.7-2 [115 kB] 107s Get:115 http://ftpmaster.internal/ubuntu resolute/universe s390x node-cjs-module-lexer all 1.2.3+dfsg-1 [32.1 kB] 107s Get:116 http://ftpmaster.internal/ubuntu resolute/universe s390x node-balanced-match all 2.0.0-1 [4910 B] 107s Get:117 http://ftpmaster.internal/ubuntu resolute/universe s390x node-brace-expansion all 2.0.1+~1.1.0-2 [8172 B] 107s Get:118 http://ftpmaster.internal/ubuntu resolute/universe s390x node-minimatch all 9.0.3-6 [78.0 kB] 107s Get:119 http://ftpmaster.internal/ubuntu resolute/universe s390x node-ms all 2.1.3+~cs0.7.31-3 [5738 B] 107s Get:120 http://ftpmaster.internal/ubuntu resolute/universe s390x node-debug all 4.4.1+~4.1.12-1 [17.7 kB] 107s Get:121 http://ftpmaster.internal/ubuntu resolute/universe s390x node-lru-cache all 10.0.1-3 [61.9 kB] 107s Get:122 http://ftpmaster.internal/ubuntu resolute/universe s390x node-semver all 7.6.1+~7.5.8-2 [45.2 kB] 107s Get:123 http://ftpmaster.internal/ubuntu resolute/universe s390x node-llhttp all 9.3.3~really9.3.0+~cs12.11.8-3 [158 kB] 107s Get:124 http://ftpmaster.internal/ubuntu resolute/universe s390x node-undici all 7.16.0+dfsg+~cs3.2.0-2 [380 kB] 107s Get:125 http://ftpmaster.internal/ubuntu resolute/universe s390x libnode115 s390x 20.19.4+dfsg-1 [14.2 MB] 107s Get:126 http://ftpmaster.internal/ubuntu resolute/universe s390x libnorm1t64 s390x 1.5.9+dfsg-4 [156 kB] 107s Get:127 http://ftpmaster.internal/ubuntu resolute/universe s390x libpgm-5.3-0t64 s390x 5.3.128~dfsg-2.1build1 [169 kB] 107s Get:128 http://ftpmaster.internal/ubuntu resolute/universe s390x proj-data all 9.7.0-1 [7970 kB] 108s Get:129 http://ftpmaster.internal/ubuntu resolute/main s390x libjbig0 s390x 2.1-6.1ubuntu2 [33.1 kB] 108s Get:130 http://ftpmaster.internal/ubuntu resolute/main s390x libsharpyuv0 s390x 1.5.0-0.1 [16.7 kB] 108s Get:131 http://ftpmaster.internal/ubuntu resolute/main s390x libwebp7 s390x 1.5.0-0.1 [210 kB] 108s Get:132 http://ftpmaster.internal/ubuntu resolute/main s390x libtiff6 s390x 4.7.0-3ubuntu3 [222 kB] 108s Get:133 http://ftpmaster.internal/ubuntu resolute/universe s390x libproj25 s390x 9.7.0-1 [1485 kB] 108s Get:134 http://ftpmaster.internal/ubuntu resolute/main s390x libpython3.14-stdlib s390x 3.14.0-4 [2373 kB] 108s Get:135 http://ftpmaster.internal/ubuntu resolute/universe s390x libqhull-r8.0 s390x 2020.2-7 [199 kB] 108s Get:136 http://ftpmaster.internal/ubuntu resolute/main s390x libraqm0 s390x 0.10.3-1 [15.6 kB] 108s Get:137 http://ftpmaster.internal/ubuntu resolute/main s390x libsodium23 s390x 1.0.18-1build3 [138 kB] 108s Get:138 http://ftpmaster.internal/ubuntu resolute/main s390x libwebpdemux2 s390x 1.5.0-0.1 [12.6 kB] 108s Get:139 http://ftpmaster.internal/ubuntu resolute/main s390x libwebpmux3 s390x 1.5.0-0.1 [25.8 kB] 108s Get:140 http://ftpmaster.internal/ubuntu resolute/main s390x libxslt1.1 s390x 1.1.43-0.3 [163 kB] 108s Get:141 http://ftpmaster.internal/ubuntu resolute/universe s390x libzmq5 s390x 4.3.5-1build2 [258 kB] 108s Get:142 http://ftpmaster.internal/ubuntu resolute/universe s390x libzopfli1 s390x 1.0.3-3 [124 kB] 108s Get:143 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-mypy-extensions all 1.1.0-1 [6716 B] 108s Get:144 http://ftpmaster.internal/ubuntu resolute/main s390x python3-psutil s390x 7.1.0-1ubuntu1 [191 kB] 108s Get:145 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-mypy s390x 1.15.0-5 [9260 kB] 108s Get:146 http://ftpmaster.internal/ubuntu resolute/universe s390x mypy all 1.15.0-5 [25.4 kB] 108s Get:147 http://ftpmaster.internal/ubuntu resolute/universe s390x node-esprima all 4.0.1+ds+~4.0.3-2 [69.3 kB] 108s Get:148 http://ftpmaster.internal/ubuntu resolute/universe s390x node-fortawesome-fontawesome-free all 6.7.2+ds1-1 [1653 kB] 108s Get:149 http://ftpmaster.internal/ubuntu resolute/universe s390x node-sprintf-js all 1.1.2+ds1+~1.1.2-1 [3916 B] 108s Get:150 http://ftpmaster.internal/ubuntu resolute/universe s390x node-argparse all 2.0.1-2 [33.2 kB] 108s Get:151 http://ftpmaster.internal/ubuntu resolute/universe s390x node-js-yaml all 4.1.0+dfsg+~4.0.5-7 [61.9 kB] 108s Get:152 http://ftpmaster.internal/ubuntu resolute/universe s390x pandoc-data all 3.1.11.1-3build1 [78.8 kB] 108s Get:153 http://ftpmaster.internal/ubuntu resolute/universe s390x pandoc s390x 3.1.11.1+ds-4 [52.5 MB] 110s Get:154 http://ftpmaster.internal/ubuntu resolute/universe s390x pybuild-plugin-autopkgtest all 6.20250414 [1746 B] 110s Get:155 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 110s Get:156 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-wheel all 0.46.1-2 [22.1 kB] 110s Get:157 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-build all 1.2.2-4 [31.0 kB] 110s Get:158 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-installer all 0.7.0+dfsg1-3 [17.4 kB] 110s Get:159 http://ftpmaster.internal/ubuntu resolute/universe s390x pybuild-plugin-pyproject all 6.20250414 [1728 B] 110s Get:160 http://ftpmaster.internal/ubuntu resolute/universe s390x python-cartopy-data all 0.25.0+dfsg-1 [6537 kB] 110s Get:161 http://ftpmaster.internal/ubuntu resolute/main s390x libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 110s Get:162 http://ftpmaster.internal/ubuntu resolute/universe s390x python-dask-doc all 2024.12.1+dfsg-2 [10.4 MB] 111s Get:163 http://ftpmaster.internal/ubuntu resolute/universe s390x python-matplotlib-data all 3.10.7+dfsg1-1 [2930 kB] 111s Get:164 http://ftpmaster.internal/ubuntu resolute/universe s390x python-pandas-doc all 2.3.3+dfsg-1ubuntu1 [14.1 MB] 111s Get:165 http://ftpmaster.internal/ubuntu resolute/universe s390x python-tinycss2-common all 1.4.0-2 [47.0 kB] 111s Get:166 http://ftpmaster.internal/ubuntu resolute/universe s390x libjs-requirejs all 2.3.7+ds+~2.1.37-1 [201 kB] 111s Get:167 http://ftpmaster.internal/ubuntu resolute/universe s390x python-xarray-doc all 2025.03.1-8 [5284 kB] 112s Get:168 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-accessible-pygments all 0.0.5-2 [790 kB] 112s Get:169 http://ftpmaster.internal/ubuntu resolute/main s390x python3.14 s390x 3.14.0-4 [805 kB] 112s Get:170 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x python3-all s390x 3.13.7-2 [892 B] 112s Get:171 http://ftpmaster.internal/ubuntu resolute/main s390x python3-defusedxml all 0.7.1-3 [42.2 kB] 112s Get:172 http://ftpmaster.internal/ubuntu resolute/main s390x sphinx-common all 8.2.3-1ubuntu2 [656 kB] 112s Get:173 http://ftpmaster.internal/ubuntu resolute/main s390x python3-alabaster all 0.7.16-0.1 [18.5 kB] 112s Get:174 http://ftpmaster.internal/ubuntu resolute/main s390x python3-roman all 5.1-1 [10.6 kB] 112s Get:175 http://ftpmaster.internal/ubuntu resolute/main s390x python3-docutils all 0.21.2+dfsg-2 [409 kB] 112s Get:176 http://ftpmaster.internal/ubuntu resolute/main s390x python3-imagesize all 1.4.1-1 [6844 B] 112s Get:177 http://ftpmaster.internal/ubuntu resolute/main s390x python3-snowballstemmer all 3.0.1-1 [65.9 kB] 112s Get:178 http://ftpmaster.internal/ubuntu resolute/main s390x python3-sphinx all 8.2.3-1ubuntu2 [482 kB] 112s Get:179 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-autodocsumm all 0.2.14-2 [11.9 kB] 112s Get:180 http://ftpmaster.internal/ubuntu resolute/main s390x python3-webencodings all 0.5.1-5 [11.5 kB] 112s Get:181 http://ftpmaster.internal/ubuntu resolute/main s390x python3-html5lib all 1.2-2 [90.6 kB] 112s Get:182 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-bleach all 6.2.0-1 [43.9 kB] 112s Get:183 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-bottleneck s390x 1.4.2+ds1-2build2 [118 kB] 112s Get:184 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-brotli s390x 1.1.0-2build6 [386 kB] 112s Get:185 http://ftpmaster.internal/ubuntu resolute/main s390x python3-soupsieve all 2.7-2 [33.6 kB] 112s Get:186 http://ftpmaster.internal/ubuntu resolute/main s390x python3-bs4 all 4.13.4-3 [137 kB] 112s Get:187 http://ftpmaster.internal/ubuntu resolute/main s390x libopenjp2-7 s390x 2.5.3-2.1 [207 kB] 112s Get:188 http://ftpmaster.internal/ubuntu resolute/main s390x python3-pil s390x 11.3.0-1ubuntu2 [542 kB] 112s Get:189 http://ftpmaster.internal/ubuntu resolute/main s390x python3.14-tk s390x 3.14.0-4 [109 kB] 112s Get:190 http://ftpmaster.internal/ubuntu resolute/main s390x python3.13-tk s390x 3.13.9-1 [109 kB] 112s Get:191 http://ftpmaster.internal/ubuntu resolute/main s390x python3-tk s390x 3.13.9-1 [8948 B] 112s Get:192 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pil.imagetk s390x 11.3.0-1ubuntu2 [9922 B] 112s Get:193 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-contourpy s390x 1.3.1-2 [266 kB] 112s Get:194 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-cycler all 0.12.1-2 [9850 B] 112s Get:195 http://ftpmaster.internal/ubuntu resolute/main s390x python3-platformdirs all 4.3.7-1 [16.9 kB] 112s Get:196 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-fs all 2.4.16-9ubuntu1 [91.5 kB] 112s Get:197 http://ftpmaster.internal/ubuntu resolute/main s390x python3-lxml s390x 6.0.2-1 [2478 kB] 112s Get:198 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-lz4 s390x 4.4.4+dfsg-3 [27.4 kB] 112s Get:199 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-scipy s390x 1.15.3-1ubuntu1 [21.3 MB] 114s Get:200 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-mpmath all 1.3.0-2 [423 kB] 114s Get:201 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sympy all 1.14.0-2 [4306 kB] 114s Get:202 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-ufolib2 all 0.17.1+dfsg1-1 [33.5 kB] 114s Get:203 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-zopfli s390x 0.4.0-1 [11.2 kB] 114s Get:204 http://ftpmaster.internal/ubuntu resolute/universe s390x unicode-data all 16.0.0-1 [9513 kB] 117s Get:205 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-fonttools s390x 4.57.0-2build1 [1773 kB] 118s Get:206 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-kiwisolver s390x 1.4.10~rc0-1 [65.0 kB] 118s Get:207 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-matplotlib s390x 3.10.7+dfsg1-1 [17.2 MB] 119s Get:208 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pyproj s390x 3.7.2-1 [674 kB] 119s Get:209 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pyshp all 2.3.1-3 [61.8 kB] 119s Get:210 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-shapely s390x 2.1.2-1 [432 kB] 119s Get:211 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-cartopy s390x 0.25.0+dfsg-1 [537 kB] 119s Get:212 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-cftime s390x 1.6.5-1 [540 kB] 119s Get:213 http://ftpmaster.internal/ubuntu resolute/main s390x python3-click all 8.2.0+0.really.8.1.8-1 [80.0 kB] 119s Get:214 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-cloudpickle all 3.1.1-1 [22.4 kB] 119s Get:215 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-comm all 0.2.1-1 [7016 B] 119s Get:216 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-coverage s390x 7.8.2+dfsg1-1 [156 kB] 119s Get:217 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-crc32c s390x 2.7.1-1build1 [23.3 kB] 119s Get:218 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-fsspec all 2025.3.2-1ubuntu1 [217 kB] 119s Get:219 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-toolz all 1.0.0-2 [45.0 kB] 119s Get:220 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-locket all 1.0.0-2 [5872 B] 119s Get:221 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-partd all 1.4.2-1 [15.7 kB] 119s Get:222 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-dask all 2024.12.1+dfsg-2 [875 kB] 119s Get:223 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-debugpy s390x 1.8.12+ds-1ubuntu1 [767 kB] 119s Get:224 http://ftpmaster.internal/ubuntu resolute/main s390x python3.13-doc all 3.13.9-1 [14.3 MB] 119s Get:225 http://ftpmaster.internal/ubuntu resolute-proposed/main s390x python3-doc all 3.13.7-2 [10.8 kB] 119s Get:226 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-donfig all 0.8.1+dfsg-3 [17.3 kB] 119s Get:227 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-execnet all 2.1.1-1 [33.4 kB] 119s Get:228 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-fastjsonschema all 2.21.1-1 [20.4 kB] 119s Get:229 http://ftpmaster.internal/ubuntu resolute/main s390x python3-flexcache all 0.3-2 [13.4 kB] 119s Get:230 http://ftpmaster.internal/ubuntu resolute/main s390x python3-flexparser all 0.4-1 [43.8 kB] 119s Get:231 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-h5py-serial s390x 3.13.0-1ubuntu1 [1182 kB] 119s Get:232 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-h5py all 3.13.0-1ubuntu1 [8230 B] 119s Get:233 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-h5netcdf all 1.6.1-1 [46.7 kB] 120s Get:234 http://ftpmaster.internal/ubuntu resolute/main s390x python3-sortedcontainers all 2.4.0-2 [27.6 kB] 120s Get:235 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-hypothesis all 6.130.5-2 [341 kB] 120s Get:236 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-iniconfig all 2.1.0-1 [6840 B] 120s Get:237 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-jupyter-core all 5.7.2-5 [28.1 kB] 120s Get:238 http://ftpmaster.internal/ubuntu resolute/main s390x python3-tornado s390x 6.5.2-3 [304 kB] 120s Get:239 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-zmq s390x 27.1.0-1 [248 kB] 120s Get:240 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-jupyter-client all 8.6.3-3 [78.4 kB] 120s Get:241 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-nest-asyncio all 1.5.4-1 [6256 B] 120s Get:242 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-ipykernel all 6.29.5-2 [82.7 kB] 120s Get:243 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-jupyter-console all 6.6.3-2 [21.6 kB] 120s Get:244 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-jupyterlab-pygments all 0.2.2-3 [6054 B] 120s Get:245 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-mistune all 3.1.4-1 [35.0 kB] 120s Get:246 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-nbformat all 5.9.1-1 [41.2 kB] 120s Get:247 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-nbclient all 0.8.0-2 [53.9 kB] 120s Get:248 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-tinycss2 all 1.4.0-2 [22.5 kB] 120s Get:249 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pandocfilters all 1.5.1-1 [23.6 kB] 120s Get:250 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-nbconvert all 7.16.6-1 [140 kB] 120s Get:251 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-nbsphinx all 0.9.5+ds-1 [41.0 kB] 120s Get:252 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-netcdf4 s390x 1.7.2-1build4 [645 kB] 120s Get:253 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pydata-sphinx-theme all 0.16.1+dfsg-3 [959 kB] 120s Get:254 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-numcodecs s390x 0.16.3+ds-1 [543 kB] 120s Get:255 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-numpydoc all 1.9.0-1 [53.2 kB] 120s Get:256 http://ftpmaster.internal/ubuntu resolute/main s390x python3-pytz all 2025.2-4 [32.3 kB] 120s Get:257 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pandas-lib s390x 2.3.3+dfsg-1ubuntu1 [8668 kB] 120s Get:258 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pandas all 2.3.3+dfsg-1ubuntu1 [2948 kB] 120s Get:259 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pickleshare all 0.7.5-5 [7570 B] 120s Get:260 http://ftpmaster.internal/ubuntu resolute/main s390x python3-pint all 0.24.4-2 [203 kB] 120s Get:261 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pip all 25.1.1+dfsg-1ubuntu2 [1416 kB] 120s Get:262 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pluggy all 1.6.0-1 [21.0 kB] 120s Get:263 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pooch all 1.8.2-1 [49.9 kB] 120s Get:264 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pytest all 8.3.5-2 [252 kB] 120s Get:265 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-regex s390x 0.1.20250918-1 [331 kB] 120s Get:266 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-tomlkit all 0.13.3-2 [39.1 kB] 120s Get:267 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pytest-mypy all 3.2.0-2 [21.6 kB] 120s Get:268 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-pytest-xdist all 3.8.0-2 [34.6 kB] 120s Get:269 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-seaborn all 0.13.2-5 [225 kB] 120s Get:270 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-setuptools-scm all 8.2.1-3 [32.7 kB] 120s Get:271 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-book-theme all 1.1.4-2 [83.3 kB] 120s Get:272 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-copybutton all 0.5.2-3 [16.7 kB] 120s Get:273 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-design all 0.6.1-2 [894 kB] 120s Get:274 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-gallery all 0.17.1-1 [334 kB] 120s Get:275 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-inline-tabs all 2023.4.21-3 [39.2 kB] 120s Get:276 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-remove-toctrees all 1.0.0-1 [6198 B] 120s Get:277 http://ftpmaster.internal/ubuntu resolute/main s390x sphinx-rtd-theme-common all 3.0.2+dfsg-3 [1013 kB] 121s Get:278 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinxcontrib.jquery all 4.1-6 [6856 B] 121s Get:279 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinx-rtd-theme all 3.0.2+dfsg-3 [23.5 kB] 121s Get:280 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinxcontrib-mermaid all 1.0.0-1 [4844 kB] 121s Get:281 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinxext-opengraph all 0.12.0-1 [873 kB] 121s Get:282 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-sphinxext-rediraffe all 0.3.0-1 [8414 B] 121s Get:283 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-xarray all 2025.03.1-8 [831 kB] 121s Get:284 http://ftpmaster.internal/ubuntu resolute/universe s390x python3-zarr all 3.1.3-1 [2192 kB] 121s Get:285 http://ftpmaster.internal/ubuntu resolute/main s390x tzdata-legacy all 2025b-5ubuntu1 [99.3 kB] 121s Get:286 http://ftpmaster.internal/ubuntu resolute/universe s390x python-hypothesis-doc all 6.130.5-2 [563 kB] 121s Get:287 http://ftpmaster.internal/ubuntu resolute/universe s390x python-scipy-doc all 1.15.3-1ubuntu1 [26.6 kB] 122s Fetched 344 MB in 19s (18.6 MB/s) 122s Selecting previously unselected package fonts-lato. 122s (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 ... 61309 files and directories currently installed.) 122s Preparing to unpack .../000-fonts-lato_2.015-1_all.deb ... 122s Unpacking fonts-lato (2.015-1) ... 122s Selecting previously unselected package python3-numpy-dev:s390x. 122s Preparing to unpack .../001-python3-numpy-dev_1%3a2.3.4+ds-3ubuntu1_s390x.deb ... 122s Unpacking python3-numpy-dev:s390x (1:2.3.4+ds-3ubuntu1) ... 122s Selecting previously unselected package libblas3:s390x. 122s Preparing to unpack .../002-libblas3_3.12.1-7_s390x.deb ... 122s Unpacking libblas3:s390x (3.12.1-7) ... 122s Selecting previously unselected package libgfortran5:s390x. 122s Preparing to unpack .../003-libgfortran5_15.2.0-7ubuntu1_s390x.deb ... 122s Unpacking libgfortran5:s390x (15.2.0-7ubuntu1) ... 122s Selecting previously unselected package liblapack3:s390x. 122s Preparing to unpack .../004-liblapack3_3.12.1-7_s390x.deb ... 122s Unpacking liblapack3:s390x (3.12.1-7) ... 122s Selecting previously unselected package python3-numpy. 122s Preparing to unpack .../005-python3-numpy_1%3a2.3.4+ds-3ubuntu1_s390x.deb ... 122s Unpacking python3-numpy (1:2.3.4+ds-3ubuntu1) ... 122s Selecting previously unselected package libpython3.14-minimal:s390x. 122s Preparing to unpack .../006-libpython3.14-minimal_3.14.0-4_s390x.deb ... 122s Unpacking libpython3.14-minimal:s390x (3.14.0-4) ... 123s Selecting previously unselected package python3.14-minimal. 123s Preparing to unpack .../007-python3.14-minimal_3.14.0-4_s390x.deb ... 123s Unpacking python3.14-minimal (3.14.0-4) ... 123s Selecting previously unselected package m4. 123s Preparing to unpack .../008-m4_1.4.20-2_s390x.deb ... 123s Unpacking m4 (1.4.20-2) ... 123s Selecting previously unselected package autoconf. 123s Preparing to unpack .../009-autoconf_2.72-3.1ubuntu1_all.deb ... 123s Unpacking autoconf (2.72-3.1ubuntu1) ... 123s Selecting previously unselected package autotools-dev. 123s Preparing to unpack .../010-autotools-dev_20240727.1_all.deb ... 123s Unpacking autotools-dev (20240727.1) ... 123s Selecting previously unselected package automake. 123s Preparing to unpack .../011-automake_1%3a1.18.1-2_all.deb ... 123s Unpacking automake (1:1.18.1-2) ... 123s Selecting previously unselected package autopoint. 123s Preparing to unpack .../012-autopoint_0.23.2-1_all.deb ... 123s Unpacking autopoint (0.23.2-1) ... 123s Selecting previously unselected package libtcl8.6:s390x. 123s Preparing to unpack .../013-libtcl8.6_8.6.17+dfsg-1_s390x.deb ... 123s Unpacking libtcl8.6:s390x (8.6.17+dfsg-1) ... 123s Selecting previously unselected package libfreetype6:s390x. 123s Preparing to unpack .../014-libfreetype6_2.13.3+dfsg-1build1_s390x.deb ... 123s Unpacking libfreetype6:s390x (2.13.3+dfsg-1build1) ... 123s Selecting previously unselected package fonts-dejavu-mono. 123s Preparing to unpack .../015-fonts-dejavu-mono_2.37-8_all.deb ... 123s Unpacking fonts-dejavu-mono (2.37-8) ... 123s Selecting previously unselected package fonts-dejavu-core. 123s Preparing to unpack .../016-fonts-dejavu-core_2.37-8_all.deb ... 123s Unpacking fonts-dejavu-core (2.37-8) ... 123s Selecting previously unselected package fontconfig-config. 123s Preparing to unpack .../017-fontconfig-config_2.15.0-2.3ubuntu1_s390x.deb ... 123s Unpacking fontconfig-config (2.15.0-2.3ubuntu1) ... 123s Selecting previously unselected package libfontconfig1:s390x. 123s Preparing to unpack .../018-libfontconfig1_2.15.0-2.3ubuntu1_s390x.deb ... 123s Unpacking libfontconfig1:s390x (2.15.0-2.3ubuntu1) ... 123s Selecting previously unselected package libxrender1:s390x. 123s Preparing to unpack .../019-libxrender1_1%3a0.9.12-1_s390x.deb ... 123s Unpacking libxrender1:s390x (1:0.9.12-1) ... 123s Selecting previously unselected package libxft2:s390x. 123s Preparing to unpack .../020-libxft2_2.3.6-1build1_s390x.deb ... 123s Unpacking libxft2:s390x (2.3.6-1build1) ... 123s Selecting previously unselected package x11-common. 123s Preparing to unpack .../021-x11-common_1%3a7.7+24ubuntu1_all.deb ... 123s Unpacking x11-common (1:7.7+24ubuntu1) ... 123s Selecting previously unselected package libxss1:s390x. 123s Preparing to unpack .../022-libxss1_1%3a1.2.3-1build3_s390x.deb ... 123s Unpacking libxss1:s390x (1:1.2.3-1build3) ... 123s Selecting previously unselected package libtk8.6:s390x. 123s Preparing to unpack .../023-libtk8.6_8.6.17-1_s390x.deb ... 123s Unpacking libtk8.6:s390x (8.6.17-1) ... 123s Selecting previously unselected package tk8.6-blt2.5. 123s Preparing to unpack .../024-tk8.6-blt2.5_2.5.3+dfsg-8_s390x.deb ... 123s Unpacking tk8.6-blt2.5 (2.5.3+dfsg-8) ... 123s Selecting previously unselected package blt. 123s Preparing to unpack .../025-blt_2.5.3+dfsg-8_s390x.deb ... 123s Unpacking blt (2.5.3+dfsg-8) ... 123s Selecting previously unselected package libisl23:s390x. 123s Preparing to unpack .../026-libisl23_0.27-1_s390x.deb ... 123s Unpacking libisl23:s390x (0.27-1) ... 123s Selecting previously unselected package libmpc3:s390x. 123s Preparing to unpack .../027-libmpc3_1.3.1-2_s390x.deb ... 123s Unpacking libmpc3:s390x (1.3.1-2) ... 123s Selecting previously unselected package cpp-15-s390x-linux-gnu. 123s Preparing to unpack .../028-cpp-15-s390x-linux-gnu_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking cpp-15-s390x-linux-gnu (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package cpp-15. 123s Preparing to unpack .../029-cpp-15_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking cpp-15 (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package cpp-s390x-linux-gnu. 123s Preparing to unpack .../030-cpp-s390x-linux-gnu_4%3a15.2.0-4ubuntu1_s390x.deb ... 123s Unpacking cpp-s390x-linux-gnu (4:15.2.0-4ubuntu1) ... 123s Selecting previously unselected package cpp. 123s Preparing to unpack .../031-cpp_4%3a15.2.0-4ubuntu1_s390x.deb ... 123s Unpacking cpp (4:15.2.0-4ubuntu1) ... 123s Selecting previously unselected package libcc1-0:s390x. 123s Preparing to unpack .../032-libcc1-0_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking libcc1-0:s390x (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package libgomp1:s390x. 123s Preparing to unpack .../033-libgomp1_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking libgomp1:s390x (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package libitm1:s390x. 123s Preparing to unpack .../034-libitm1_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking libitm1:s390x (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package libasan8:s390x. 123s Preparing to unpack .../035-libasan8_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking libasan8:s390x (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package libubsan1:s390x. 123s Preparing to unpack .../036-libubsan1_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking libubsan1:s390x (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package libgcc-15-dev:s390x. 123s Preparing to unpack .../037-libgcc-15-dev_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking libgcc-15-dev:s390x (15.2.0-7ubuntu1) ... 123s Selecting previously unselected package gcc-15-s390x-linux-gnu. 123s Preparing to unpack .../038-gcc-15-s390x-linux-gnu_15.2.0-7ubuntu1_s390x.deb ... 123s Unpacking gcc-15-s390x-linux-gnu (15.2.0-7ubuntu1) ... 124s Selecting previously unselected package gcc-15. 124s Preparing to unpack .../039-gcc-15_15.2.0-7ubuntu1_s390x.deb ... 124s Unpacking gcc-15 (15.2.0-7ubuntu1) ... 124s Selecting previously unselected package gcc-s390x-linux-gnu. 124s Preparing to unpack .../040-gcc-s390x-linux-gnu_4%3a15.2.0-4ubuntu1_s390x.deb ... 124s Unpacking gcc-s390x-linux-gnu (4:15.2.0-4ubuntu1) ... 124s Selecting previously unselected package gcc. 124s Preparing to unpack .../041-gcc_4%3a15.2.0-4ubuntu1_s390x.deb ... 124s Unpacking gcc (4:15.2.0-4ubuntu1) ... 124s Selecting previously unselected package libstdc++-15-dev:s390x. 124s Preparing to unpack .../042-libstdc++-15-dev_15.2.0-7ubuntu1_s390x.deb ... 124s Unpacking libstdc++-15-dev:s390x (15.2.0-7ubuntu1) ... 124s Selecting previously unselected package g++-15-s390x-linux-gnu. 124s Preparing to unpack .../043-g++-15-s390x-linux-gnu_15.2.0-7ubuntu1_s390x.deb ... 124s Unpacking g++-15-s390x-linux-gnu (15.2.0-7ubuntu1) ... 124s Selecting previously unselected package g++-15. 124s Preparing to unpack .../044-g++-15_15.2.0-7ubuntu1_s390x.deb ... 124s Unpacking g++-15 (15.2.0-7ubuntu1) ... 124s Selecting previously unselected package g++-s390x-linux-gnu. 124s Preparing to unpack .../045-g++-s390x-linux-gnu_4%3a15.2.0-4ubuntu1_s390x.deb ... 124s Unpacking g++-s390x-linux-gnu (4:15.2.0-4ubuntu1) ... 124s Selecting previously unselected package g++. 124s Preparing to unpack .../046-g++_4%3a15.2.0-4ubuntu1_s390x.deb ... 124s Unpacking g++ (4:15.2.0-4ubuntu1) ... 124s Selecting previously unselected package build-essential. 124s Preparing to unpack .../047-build-essential_12.12ubuntu1_s390x.deb ... 124s Unpacking build-essential (12.12ubuntu1) ... 124s Selecting previously unselected package libdebhelper-perl. 124s Preparing to unpack .../048-libdebhelper-perl_13.24.2ubuntu1_all.deb ... 124s Unpacking libdebhelper-perl (13.24.2ubuntu1) ... 124s Selecting previously unselected package libtool. 124s Preparing to unpack .../049-libtool_2.5.4-7_all.deb ... 124s Unpacking libtool (2.5.4-7) ... 124s Selecting previously unselected package dh-autoreconf. 124s Preparing to unpack .../050-dh-autoreconf_21_all.deb ... 124s Unpacking dh-autoreconf (21) ... 124s Selecting previously unselected package libarchive-zip-perl. 124s Preparing to unpack .../051-libarchive-zip-perl_1.68-1_all.deb ... 124s Unpacking libarchive-zip-perl (1.68-1) ... 124s Selecting previously unselected package libfile-stripnondeterminism-perl. 124s Preparing to unpack .../052-libfile-stripnondeterminism-perl_1.15.0-1_all.deb ... 124s Unpacking libfile-stripnondeterminism-perl (1.15.0-1) ... 124s Selecting previously unselected package dh-strip-nondeterminism. 124s Preparing to unpack .../053-dh-strip-nondeterminism_1.15.0-1_all.deb ... 124s Unpacking dh-strip-nondeterminism (1.15.0-1) ... 124s Selecting previously unselected package debugedit. 124s Preparing to unpack .../054-debugedit_1%3a5.2-3_s390x.deb ... 124s Unpacking debugedit (1:5.2-3) ... 124s Selecting previously unselected package dwz. 124s Preparing to unpack .../055-dwz_0.16-2_s390x.deb ... 124s Unpacking dwz (0.16-2) ... 124s Selecting previously unselected package gettext. 124s Preparing to unpack .../056-gettext_0.23.2-1_s390x.deb ... 124s Unpacking gettext (0.23.2-1) ... 124s Selecting previously unselected package intltool-debian. 124s Preparing to unpack .../057-intltool-debian_0.35.0+20060710.6_all.deb ... 124s Unpacking intltool-debian (0.35.0+20060710.6) ... 124s Selecting previously unselected package po-debconf. 124s Preparing to unpack .../058-po-debconf_1.0.21+nmu1_all.deb ... 124s Unpacking po-debconf (1.0.21+nmu1) ... 124s Selecting previously unselected package debhelper. 124s Preparing to unpack .../059-debhelper_13.24.2ubuntu1_all.deb ... 124s Unpacking debhelper (13.24.2ubuntu1) ... 124s Selecting previously unselected package dh-python. 124s Preparing to unpack .../060-dh-python_6.20250414_all.deb ... 124s Unpacking dh-python (6.20250414) ... 124s Selecting previously unselected package sgml-base. 124s Preparing to unpack .../061-sgml-base_1.31+nmu1_all.deb ... 124s Unpacking sgml-base (1.31+nmu1) ... 124s Selecting previously unselected package xml-core. 124s Preparing to unpack .../062-xml-core_0.19_all.deb ... 124s Unpacking xml-core (0.19) ... 124s Selecting previously unselected package docutils-common. 124s Preparing to unpack .../063-docutils-common_0.21.2+dfsg-2_all.deb ... 124s Unpacking docutils-common (0.21.2+dfsg-2) ... 124s Selecting previously unselected package fonts-font-awesome. 124s Preparing to unpack .../064-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 124s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 124s Selecting previously unselected package fonts-lyx. 124s Preparing to unpack .../065-fonts-lyx_2.4.4-2_all.deb ... 124s Unpacking fonts-lyx (2.4.4-2) ... 124s Selecting previously unselected package fonts-mathjax. 124s Preparing to unpack .../066-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 124s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 125s Selecting previously unselected package fonts-open-sans. 125s Preparing to unpack .../067-fonts-open-sans_1.11-2_all.deb ... 125s Unpacking fonts-open-sans (1.11-2) ... 125s Selecting previously unselected package libbabeltrace1:s390x. 125s Preparing to unpack .../068-libbabeltrace1_1.5.11-4build3_s390x.deb ... 125s Unpacking libbabeltrace1:s390x (1.5.11-4build3) ... 125s Selecting previously unselected package libsource-highlight-common. 125s Preparing to unpack .../069-libsource-highlight-common_3.1.9-4.3build1_all.deb ... 125s Unpacking libsource-highlight-common (3.1.9-4.3build1) ... 125s Selecting previously unselected package libsource-highlight4t64:s390x. 125s Preparing to unpack .../070-libsource-highlight4t64_3.1.9-4.3build1_s390x.deb ... 125s Unpacking libsource-highlight4t64:s390x (3.1.9-4.3build1) ... 125s Selecting previously unselected package gdb. 125s Preparing to unpack .../071-gdb_16.3-1ubuntu2_s390x.deb ... 125s Unpacking gdb (16.3-1ubuntu2) ... 125s Selecting previously unselected package python3-decorator. 125s Preparing to unpack .../072-python3-decorator_5.2.1-2_all.deb ... 125s Unpacking python3-decorator (5.2.1-2) ... 125s Selecting previously unselected package python3-parso. 125s Preparing to unpack .../073-python3-parso_0.8.5-1_all.deb ... 125s Unpacking python3-parso (0.8.5-1) ... 125s Selecting previously unselected package python3-typeshed. 125s Preparing to unpack .../074-python3-typeshed_0.0~git20241223.ea91db2-4_all.deb ... 125s Unpacking python3-typeshed (0.0~git20241223.ea91db2-4) ... 125s Selecting previously unselected package python3-jedi. 125s Preparing to unpack .../075-python3-jedi_0.19.1+ds1-1_all.deb ... 125s Unpacking python3-jedi (0.19.1+ds1-1) ... 125s Selecting previously unselected package python3-traitlets. 125s Preparing to unpack .../076-python3-traitlets_5.14.3+really5.14.3-1_all.deb ... 125s Unpacking python3-traitlets (5.14.3+really5.14.3-1) ... 125s Selecting previously unselected package python3-matplotlib-inline. 125s Preparing to unpack .../077-python3-matplotlib-inline_0.1.7-1_all.deb ... 125s Unpacking python3-matplotlib-inline (0.1.7-1) ... 125s Selecting previously unselected package python3-wcwidth. 125s Preparing to unpack .../078-python3-wcwidth_0.2.13+dfsg1-1_all.deb ... 125s Unpacking python3-wcwidth (0.2.13+dfsg1-1) ... 125s Selecting previously unselected package python3-prompt-toolkit. 125s Preparing to unpack .../079-python3-prompt-toolkit_3.0.52-1_all.deb ... 125s Unpacking python3-prompt-toolkit (3.0.52-1) ... 125s Selecting previously unselected package python3-asttokens. 125s Preparing to unpack .../080-python3-asttokens_3.0.0-2_all.deb ... 125s Unpacking python3-asttokens (3.0.0-2) ... 125s Selecting previously unselected package python3-executing. 125s Preparing to unpack .../081-python3-executing_2.2.0-0.2_all.deb ... 125s Unpacking python3-executing (2.2.0-0.2) ... 125s Selecting previously unselected package python3-pure-eval. 125s Preparing to unpack .../082-python3-pure-eval_0.2.3-1_all.deb ... 125s Unpacking python3-pure-eval (0.2.3-1) ... 125s Selecting previously unselected package python3-stack-data. 125s Preparing to unpack .../083-python3-stack-data_0.6.3-1_all.deb ... 125s Unpacking python3-stack-data (0.6.3-1) ... 125s Selecting previously unselected package python3-ipython. 125s Preparing to unpack .../084-python3-ipython_8.35.0-2_all.deb ... 125s Unpacking python3-ipython (8.35.0-2) ... 125s Selecting previously unselected package ipython3. 125s Preparing to unpack .../085-ipython3_8.35.0-2_all.deb ... 125s Unpacking ipython3 (8.35.0-2) ... 125s Selecting previously unselected package libaec0:s390x. 125s Preparing to unpack .../086-libaec0_1.1.4-2_s390x.deb ... 125s Unpacking libaec0:s390x (1.1.4-2) ... 125s Selecting previously unselected package libsnappy1v5:s390x. 125s Preparing to unpack .../087-libsnappy1v5_1.2.2-2_s390x.deb ... 125s Unpacking libsnappy1v5:s390x (1.2.2-2) ... 125s Selecting previously unselected package libblosc1:s390x. 125s Preparing to unpack .../088-libblosc1_1.21.5+ds-2_s390x.deb ... 125s Unpacking libblosc1:s390x (1.21.5+ds-2) ... 125s Selecting previously unselected package libcares2:s390x. 125s Preparing to unpack .../089-libcares2_1.34.5-1_s390x.deb ... 125s Unpacking libcares2:s390x (1.34.5-1) ... 125s Selecting previously unselected package libdeflate0:s390x. 125s Preparing to unpack .../090-libdeflate0_1.23-2_s390x.deb ... 125s Unpacking libdeflate0:s390x (1.23-2) ... 125s Selecting previously unselected package libgeos3.13.1:s390x. 125s Preparing to unpack .../091-libgeos3.13.1_3.13.1-1_s390x.deb ... 125s Unpacking libgeos3.13.1:s390x (3.13.1-1) ... 125s Selecting previously unselected package libgeos-c1t64:s390x. 125s Preparing to unpack .../092-libgeos-c1t64_3.13.1-1_s390x.deb ... 125s Unpacking libgeos-c1t64:s390x (3.13.1-1) ... 125s Selecting previously unselected package libgraphite2-3:s390x. 125s Preparing to unpack .../093-libgraphite2-3_1.3.14-2ubuntu1_s390x.deb ... 125s Unpacking libgraphite2-3:s390x (1.3.14-2ubuntu1) ... 125s Selecting previously unselected package libharfbuzz0b:s390x. 125s Preparing to unpack .../094-libharfbuzz0b_12.1.0-1_s390x.deb ... 125s Unpacking libharfbuzz0b:s390x (12.1.0-1) ... 125s Selecting previously unselected package libsz2:s390x. 125s Preparing to unpack .../095-libsz2_1.1.4-2_s390x.deb ... 125s Unpacking libsz2:s390x (1.1.4-2) ... 125s Selecting previously unselected package libhdf5-310:s390x. 125s Preparing to unpack .../096-libhdf5-310_1.14.5+repack-4_s390x.deb ... 125s Unpacking libhdf5-310:s390x (1.14.5+repack-4) ... 125s Selecting previously unselected package libhdf5-hl-310:s390x. 125s Preparing to unpack .../097-libhdf5-hl-310_1.14.5+repack-4_s390x.deb ... 125s Unpacking libhdf5-hl-310:s390x (1.14.5+repack-4) ... 125s Selecting previously unselected package libimagequant0:s390x. 125s Preparing to unpack .../098-libimagequant0_2.18.0-1build1_s390x.deb ... 125s Unpacking libimagequant0:s390x (2.18.0-1build1) ... 125s Selecting previously unselected package libjpeg-turbo8:s390x. 125s Preparing to unpack .../099-libjpeg-turbo8_2.1.5-4ubuntu2_s390x.deb ... 125s Unpacking libjpeg-turbo8:s390x (2.1.5-4ubuntu2) ... 125s Selecting previously unselected package libjpeg8:s390x. 125s Preparing to unpack .../100-libjpeg8_8c-2ubuntu11_s390x.deb ... 125s Unpacking libjpeg8:s390x (8c-2ubuntu11) ... 125s Selecting previously unselected package libjs-jquery. 125s Preparing to unpack .../101-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 125s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 125s Selecting previously unselected package libjs-underscore. 125s Preparing to unpack .../102-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 125s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 125s Selecting previously unselected package libjs-sphinxdoc. 125s Preparing to unpack .../103-libjs-sphinxdoc_8.2.3-1ubuntu2_all.deb ... 125s Unpacking libjs-sphinxdoc (8.2.3-1ubuntu2) ... 125s Selecting previously unselected package libjs-sprintf-js. 125s Preparing to unpack .../104-libjs-sprintf-js_1.1.2+ds1+~1.1.2-1_all.deb ... 125s Unpacking libjs-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 125s Selecting previously unselected package libjson-perl. 125s Preparing to unpack .../105-libjson-perl_4.10000-1_all.deb ... 125s Unpacking libjson-perl (4.10000-1) ... 125s Selecting previously unselected package liblcms2-2:s390x. 125s Preparing to unpack .../106-liblcms2-2_2.17-1_s390x.deb ... 125s Unpacking liblcms2-2:s390x (2.17-1) ... 126s Selecting previously unselected package liblua5.4-0:s390x. 126s Preparing to unpack .../107-liblua5.4-0_5.4.8-1_s390x.deb ... 126s Unpacking liblua5.4-0:s390x (5.4.8-1) ... 126s Selecting previously unselected package liblzf1:s390x. 126s Preparing to unpack .../108-liblzf1_3.6-4_s390x.deb ... 126s Unpacking liblzf1:s390x (3.6-4) ... 126s Selecting previously unselected package libnetcdf22:s390x. 126s Preparing to unpack .../109-libnetcdf22_1%3a4.9.3-1build1_s390x.deb ... 126s Unpacking libnetcdf22:s390x (1:4.9.3-1build1) ... 126s Selecting previously unselected package node-xtend. 126s Preparing to unpack .../110-node-xtend_4.0.2-3_all.deb ... 126s Unpacking node-xtend (4.0.2-3) ... 126s Selecting previously unselected package node-corepack. 126s Preparing to unpack .../111-node-corepack_0.24.0-5_all.deb ... 126s Unpacking node-corepack (0.24.0-5) ... 126s Selecting previously unselected package nodejs. 126s Preparing to unpack .../112-nodejs_20.19.4+dfsg-1_s390x.deb ... 126s Unpacking nodejs (20.19.4+dfsg-1) ... 126s Selecting previously unselected package node-acorn. 126s Preparing to unpack .../113-node-acorn_8.8.1+ds+~cs25.17.7-2_all.deb ... 126s Unpacking node-acorn (8.8.1+ds+~cs25.17.7-2) ... 126s Selecting previously unselected package node-cjs-module-lexer. 126s Preparing to unpack .../114-node-cjs-module-lexer_1.2.3+dfsg-1_all.deb ... 126s Unpacking node-cjs-module-lexer (1.2.3+dfsg-1) ... 126s Selecting previously unselected package node-balanced-match. 126s Preparing to unpack .../115-node-balanced-match_2.0.0-1_all.deb ... 126s Unpacking node-balanced-match (2.0.0-1) ... 126s Selecting previously unselected package node-brace-expansion. 126s Preparing to unpack .../116-node-brace-expansion_2.0.1+~1.1.0-2_all.deb ... 126s Unpacking node-brace-expansion (2.0.1+~1.1.0-2) ... 126s Selecting previously unselected package node-minimatch. 126s Preparing to unpack .../117-node-minimatch_9.0.3-6_all.deb ... 126s Unpacking node-minimatch (9.0.3-6) ... 126s Selecting previously unselected package node-ms. 126s Preparing to unpack .../118-node-ms_2.1.3+~cs0.7.31-3_all.deb ... 126s Unpacking node-ms (2.1.3+~cs0.7.31-3) ... 126s Selecting previously unselected package node-debug. 126s Preparing to unpack .../119-node-debug_4.4.1+~4.1.12-1_all.deb ... 126s Unpacking node-debug (4.4.1+~4.1.12-1) ... 126s Selecting previously unselected package node-lru-cache. 126s Preparing to unpack .../120-node-lru-cache_10.0.1-3_all.deb ... 126s Unpacking node-lru-cache (10.0.1-3) ... 126s Selecting previously unselected package node-semver. 126s Preparing to unpack .../121-node-semver_7.6.1+~7.5.8-2_all.deb ... 126s Unpacking node-semver (7.6.1+~7.5.8-2) ... 126s Selecting previously unselected package node-llhttp. 126s Preparing to unpack .../122-node-llhttp_9.3.3~really9.3.0+~cs12.11.8-3_all.deb ... 126s Unpacking node-llhttp (9.3.3~really9.3.0+~cs12.11.8-3) ... 126s Selecting previously unselected package node-undici. 126s Preparing to unpack .../123-node-undici_7.16.0+dfsg+~cs3.2.0-2_all.deb ... 126s Unpacking node-undici (7.16.0+dfsg+~cs3.2.0-2) ... 126s Selecting previously unselected package libnode115:s390x. 126s Preparing to unpack .../124-libnode115_20.19.4+dfsg-1_s390x.deb ... 126s Unpacking libnode115:s390x (20.19.4+dfsg-1) ... 126s Selecting previously unselected package libnorm1t64:s390x. 126s Preparing to unpack .../125-libnorm1t64_1.5.9+dfsg-4_s390x.deb ... 126s Unpacking libnorm1t64:s390x (1.5.9+dfsg-4) ... 126s Selecting previously unselected package libpgm-5.3-0t64:s390x. 126s Preparing to unpack .../126-libpgm-5.3-0t64_5.3.128~dfsg-2.1build1_s390x.deb ... 126s Unpacking libpgm-5.3-0t64:s390x (5.3.128~dfsg-2.1build1) ... 126s Selecting previously unselected package proj-data. 126s Preparing to unpack .../127-proj-data_9.7.0-1_all.deb ... 126s Unpacking proj-data (9.7.0-1) ... 126s Selecting previously unselected package libjbig0:s390x. 126s Preparing to unpack .../128-libjbig0_2.1-6.1ubuntu2_s390x.deb ... 126s Unpacking libjbig0:s390x (2.1-6.1ubuntu2) ... 126s Selecting previously unselected package libsharpyuv0:s390x. 126s Preparing to unpack .../129-libsharpyuv0_1.5.0-0.1_s390x.deb ... 126s Unpacking libsharpyuv0:s390x (1.5.0-0.1) ... 126s Selecting previously unselected package libwebp7:s390x. 126s Preparing to unpack .../130-libwebp7_1.5.0-0.1_s390x.deb ... 126s Unpacking libwebp7:s390x (1.5.0-0.1) ... 126s Selecting previously unselected package libtiff6:s390x. 126s Preparing to unpack .../131-libtiff6_4.7.0-3ubuntu3_s390x.deb ... 126s Unpacking libtiff6:s390x (4.7.0-3ubuntu3) ... 126s Selecting previously unselected package libproj25:s390x. 126s Preparing to unpack .../132-libproj25_9.7.0-1_s390x.deb ... 126s Unpacking libproj25:s390x (9.7.0-1) ... 126s Selecting previously unselected package libpython3.14-stdlib:s390x. 126s Preparing to unpack .../133-libpython3.14-stdlib_3.14.0-4_s390x.deb ... 126s Unpacking libpython3.14-stdlib:s390x (3.14.0-4) ... 126s Selecting previously unselected package libqhull-r8.0:s390x. 126s Preparing to unpack .../134-libqhull-r8.0_2020.2-7_s390x.deb ... 126s Unpacking libqhull-r8.0:s390x (2020.2-7) ... 126s Selecting previously unselected package libraqm0:s390x. 126s Preparing to unpack .../135-libraqm0_0.10.3-1_s390x.deb ... 126s Unpacking libraqm0:s390x (0.10.3-1) ... 126s Selecting previously unselected package libsodium23:s390x. 126s Preparing to unpack .../136-libsodium23_1.0.18-1build3_s390x.deb ... 126s Unpacking libsodium23:s390x (1.0.18-1build3) ... 126s Selecting previously unselected package libwebpdemux2:s390x. 126s Preparing to unpack .../137-libwebpdemux2_1.5.0-0.1_s390x.deb ... 126s Unpacking libwebpdemux2:s390x (1.5.0-0.1) ... 126s Selecting previously unselected package libwebpmux3:s390x. 126s Preparing to unpack .../138-libwebpmux3_1.5.0-0.1_s390x.deb ... 126s Unpacking libwebpmux3:s390x (1.5.0-0.1) ... 126s Selecting previously unselected package libxslt1.1:s390x. 126s Preparing to unpack .../139-libxslt1.1_1.1.43-0.3_s390x.deb ... 126s Unpacking libxslt1.1:s390x (1.1.43-0.3) ... 126s Selecting previously unselected package libzmq5:s390x. 126s Preparing to unpack .../140-libzmq5_4.3.5-1build2_s390x.deb ... 126s Unpacking libzmq5:s390x (4.3.5-1build2) ... 126s Selecting previously unselected package libzopfli1. 126s Preparing to unpack .../141-libzopfli1_1.0.3-3_s390x.deb ... 126s Unpacking libzopfli1 (1.0.3-3) ... 126s Selecting previously unselected package python3-mypy-extensions. 126s Preparing to unpack .../142-python3-mypy-extensions_1.1.0-1_all.deb ... 126s Unpacking python3-mypy-extensions (1.1.0-1) ... 126s Selecting previously unselected package python3-psutil. 126s Preparing to unpack .../143-python3-psutil_7.1.0-1ubuntu1_s390x.deb ... 126s Unpacking python3-psutil (7.1.0-1ubuntu1) ... 126s Selecting previously unselected package python3-mypy. 127s Preparing to unpack .../144-python3-mypy_1.15.0-5_s390x.deb ... 127s Unpacking python3-mypy (1.15.0-5) ... 127s Selecting previously unselected package mypy. 127s Preparing to unpack .../145-mypy_1.15.0-5_all.deb ... 127s Unpacking mypy (1.15.0-5) ... 127s Selecting previously unselected package node-esprima. 127s Preparing to unpack .../146-node-esprima_4.0.1+ds+~4.0.3-2_all.deb ... 127s Unpacking node-esprima (4.0.1+ds+~4.0.3-2) ... 127s Selecting previously unselected package node-fortawesome-fontawesome-free. 127s Preparing to unpack .../147-node-fortawesome-fontawesome-free_6.7.2+ds1-1_all.deb ... 127s Unpacking node-fortawesome-fontawesome-free (6.7.2+ds1-1) ... 127s Selecting previously unselected package node-sprintf-js. 127s Preparing to unpack .../148-node-sprintf-js_1.1.2+ds1+~1.1.2-1_all.deb ... 127s Unpacking node-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 127s Selecting previously unselected package node-argparse. 127s Preparing to unpack .../149-node-argparse_2.0.1-2_all.deb ... 127s Unpacking node-argparse (2.0.1-2) ... 127s Selecting previously unselected package node-js-yaml. 127s Preparing to unpack .../150-node-js-yaml_4.1.0+dfsg+~4.0.5-7_all.deb ... 127s Unpacking node-js-yaml (4.1.0+dfsg+~4.0.5-7) ... 127s Selecting previously unselected package pandoc-data. 127s Preparing to unpack .../151-pandoc-data_3.1.11.1-3build1_all.deb ... 127s Unpacking pandoc-data (3.1.11.1-3build1) ... 127s Selecting previously unselected package pandoc. 127s Preparing to unpack .../152-pandoc_3.1.11.1+ds-4_s390x.deb ... 127s Unpacking pandoc (3.1.11.1+ds-4) ... 128s Selecting previously unselected package pybuild-plugin-autopkgtest. 128s Preparing to unpack .../153-pybuild-plugin-autopkgtest_6.20250414_all.deb ... 128s Unpacking pybuild-plugin-autopkgtest (6.20250414) ... 128s Selecting previously unselected package python3-pyproject-hooks. 128s Preparing to unpack .../154-python3-pyproject-hooks_1.2.0-1_all.deb ... 128s Unpacking python3-pyproject-hooks (1.2.0-1) ... 128s Selecting previously unselected package python3-wheel. 128s Preparing to unpack .../155-python3-wheel_0.46.1-2_all.deb ... 128s Unpacking python3-wheel (0.46.1-2) ... 128s Selecting previously unselected package python3-build. 128s Preparing to unpack .../156-python3-build_1.2.2-4_all.deb ... 128s Unpacking python3-build (1.2.2-4) ... 128s Selecting previously unselected package python3-installer. 128s Preparing to unpack .../157-python3-installer_0.7.0+dfsg1-3_all.deb ... 128s Unpacking python3-installer (0.7.0+dfsg1-3) ... 128s Selecting previously unselected package pybuild-plugin-pyproject. 128s Preparing to unpack .../158-pybuild-plugin-pyproject_6.20250414_all.deb ... 128s Unpacking pybuild-plugin-pyproject (6.20250414) ... 128s Selecting previously unselected package python-cartopy-data. 128s Preparing to unpack .../159-python-cartopy-data_0.25.0+dfsg-1_all.deb ... 128s Unpacking python-cartopy-data (0.25.0+dfsg-1) ... 128s Selecting previously unselected package libjs-mathjax. 128s Preparing to unpack .../160-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 128s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 129s Selecting previously unselected package python-dask-doc. 129s Preparing to unpack .../161-python-dask-doc_2024.12.1+dfsg-2_all.deb ... 129s Unpacking python-dask-doc (2024.12.1+dfsg-2) ... 129s Selecting previously unselected package python-matplotlib-data. 129s Preparing to unpack .../162-python-matplotlib-data_3.10.7+dfsg1-1_all.deb ... 129s Unpacking python-matplotlib-data (3.10.7+dfsg1-1) ... 129s Selecting previously unselected package python-pandas-doc. 129s Preparing to unpack .../163-python-pandas-doc_2.3.3+dfsg-1ubuntu1_all.deb ... 129s Unpacking python-pandas-doc (2.3.3+dfsg-1ubuntu1) ... 130s Selecting previously unselected package python-tinycss2-common. 130s Preparing to unpack .../164-python-tinycss2-common_1.4.0-2_all.deb ... 130s Unpacking python-tinycss2-common (1.4.0-2) ... 130s Selecting previously unselected package libjs-requirejs. 130s Preparing to unpack .../165-libjs-requirejs_2.3.7+ds+~2.1.37-1_all.deb ... 130s Unpacking libjs-requirejs (2.3.7+ds+~2.1.37-1) ... 130s Selecting previously unselected package python-xarray-doc. 130s Preparing to unpack .../166-python-xarray-doc_2025.03.1-8_all.deb ... 130s Unpacking python-xarray-doc (2025.03.1-8) ... 130s Selecting previously unselected package python3-accessible-pygments. 130s Preparing to unpack .../167-python3-accessible-pygments_0.0.5-2_all.deb ... 130s Unpacking python3-accessible-pygments (0.0.5-2) ... 130s Selecting previously unselected package python3.14. 130s Preparing to unpack .../168-python3.14_3.14.0-4_s390x.deb ... 130s Unpacking python3.14 (3.14.0-4) ... 130s Selecting previously unselected package python3-all. 130s Preparing to unpack .../169-python3-all_3.13.7-2_s390x.deb ... 130s Unpacking python3-all (3.13.7-2) ... 130s Selecting previously unselected package python3-defusedxml. 130s Preparing to unpack .../170-python3-defusedxml_0.7.1-3_all.deb ... 130s Unpacking python3-defusedxml (0.7.1-3) ... 130s Selecting previously unselected package sphinx-common. 130s Preparing to unpack .../171-sphinx-common_8.2.3-1ubuntu2_all.deb ... 130s Unpacking sphinx-common (8.2.3-1ubuntu2) ... 130s Selecting previously unselected package python3-alabaster. 130s Preparing to unpack .../172-python3-alabaster_0.7.16-0.1_all.deb ... 130s Unpacking python3-alabaster (0.7.16-0.1) ... 130s Selecting previously unselected package python3-roman. 130s Preparing to unpack .../173-python3-roman_5.1-1_all.deb ... 130s Unpacking python3-roman (5.1-1) ... 130s Selecting previously unselected package python3-docutils. 130s Preparing to unpack .../174-python3-docutils_0.21.2+dfsg-2_all.deb ... 130s Unpacking python3-docutils (0.21.2+dfsg-2) ... 130s Selecting previously unselected package python3-imagesize. 130s Preparing to unpack .../175-python3-imagesize_1.4.1-1_all.deb ... 130s Unpacking python3-imagesize (1.4.1-1) ... 130s Selecting previously unselected package python3-snowballstemmer. 130s Preparing to unpack .../176-python3-snowballstemmer_3.0.1-1_all.deb ... 130s Unpacking python3-snowballstemmer (3.0.1-1) ... 130s Selecting previously unselected package python3-sphinx. 130s Preparing to unpack .../177-python3-sphinx_8.2.3-1ubuntu2_all.deb ... 130s Unpacking python3-sphinx (8.2.3-1ubuntu2) ... 131s Selecting previously unselected package python3-autodocsumm. 131s Preparing to unpack .../178-python3-autodocsumm_0.2.14-2_all.deb ... 131s Unpacking python3-autodocsumm (0.2.14-2) ... 131s Selecting previously unselected package python3-webencodings. 131s Preparing to unpack .../179-python3-webencodings_0.5.1-5_all.deb ... 131s Unpacking python3-webencodings (0.5.1-5) ... 131s Selecting previously unselected package python3-html5lib. 131s Preparing to unpack .../180-python3-html5lib_1.2-2_all.deb ... 131s Unpacking python3-html5lib (1.2-2) ... 131s Selecting previously unselected package python3-bleach. 131s Preparing to unpack .../181-python3-bleach_6.2.0-1_all.deb ... 131s Unpacking python3-bleach (6.2.0-1) ... 131s Selecting previously unselected package python3-bottleneck. 131s Preparing to unpack .../182-python3-bottleneck_1.4.2+ds1-2build2_s390x.deb ... 131s Unpacking python3-bottleneck (1.4.2+ds1-2build2) ... 131s Selecting previously unselected package python3-brotli. 131s Preparing to unpack .../183-python3-brotli_1.1.0-2build6_s390x.deb ... 131s Unpacking python3-brotli (1.1.0-2build6) ... 131s Selecting previously unselected package python3-soupsieve. 131s Preparing to unpack .../184-python3-soupsieve_2.7-2_all.deb ... 131s Unpacking python3-soupsieve (2.7-2) ... 131s Selecting previously unselected package python3-bs4. 131s Preparing to unpack .../185-python3-bs4_4.13.4-3_all.deb ... 131s Unpacking python3-bs4 (4.13.4-3) ... 131s Selecting previously unselected package libopenjp2-7:s390x. 131s Preparing to unpack .../186-libopenjp2-7_2.5.3-2.1_s390x.deb ... 131s Unpacking libopenjp2-7:s390x (2.5.3-2.1) ... 131s Selecting previously unselected package python3-pil:s390x. 131s Preparing to unpack .../187-python3-pil_11.3.0-1ubuntu2_s390x.deb ... 131s Unpacking python3-pil:s390x (11.3.0-1ubuntu2) ... 131s Selecting previously unselected package python3.14-tk. 131s Preparing to unpack .../188-python3.14-tk_3.14.0-4_s390x.deb ... 131s Unpacking python3.14-tk (3.14.0-4) ... 131s Selecting previously unselected package python3.13-tk. 131s Preparing to unpack .../189-python3.13-tk_3.13.9-1_s390x.deb ... 131s Unpacking python3.13-tk (3.13.9-1) ... 131s Selecting previously unselected package python3-tk:s390x. 131s Preparing to unpack .../190-python3-tk_3.13.9-1_s390x.deb ... 131s Unpacking python3-tk:s390x (3.13.9-1) ... 131s Selecting previously unselected package python3-pil.imagetk:s390x. 131s Preparing to unpack .../191-python3-pil.imagetk_11.3.0-1ubuntu2_s390x.deb ... 131s Unpacking python3-pil.imagetk:s390x (11.3.0-1ubuntu2) ... 131s Selecting previously unselected package python3-contourpy. 131s Preparing to unpack .../192-python3-contourpy_1.3.1-2_s390x.deb ... 131s Unpacking python3-contourpy (1.3.1-2) ... 131s Selecting previously unselected package python3-cycler. 131s Preparing to unpack .../193-python3-cycler_0.12.1-2_all.deb ... 131s Unpacking python3-cycler (0.12.1-2) ... 131s Selecting previously unselected package python3-platformdirs. 131s Preparing to unpack .../194-python3-platformdirs_4.3.7-1_all.deb ... 131s Unpacking python3-platformdirs (4.3.7-1) ... 131s Selecting previously unselected package python3-fs. 131s Preparing to unpack .../195-python3-fs_2.4.16-9ubuntu1_all.deb ... 131s Unpacking python3-fs (2.4.16-9ubuntu1) ... 131s Selecting previously unselected package python3-lxml:s390x. 131s Preparing to unpack .../196-python3-lxml_6.0.2-1_s390x.deb ... 131s Unpacking python3-lxml:s390x (6.0.2-1) ... 131s Selecting previously unselected package python3-lz4. 131s Preparing to unpack .../197-python3-lz4_4.4.4+dfsg-3_s390x.deb ... 131s Unpacking python3-lz4 (4.4.4+dfsg-3) ... 131s Selecting previously unselected package python3-scipy. 131s Preparing to unpack .../198-python3-scipy_1.15.3-1ubuntu1_s390x.deb ... 131s Unpacking python3-scipy (1.15.3-1ubuntu1) ... 132s Selecting previously unselected package python3-mpmath. 132s Preparing to unpack .../199-python3-mpmath_1.3.0-2_all.deb ... 132s Unpacking python3-mpmath (1.3.0-2) ... 132s Selecting previously unselected package python3-sympy. 132s Preparing to unpack .../200-python3-sympy_1.14.0-2_all.deb ... 132s Unpacking python3-sympy (1.14.0-2) ... 132s Selecting previously unselected package python3-ufolib2. 132s Preparing to unpack .../201-python3-ufolib2_0.17.1+dfsg1-1_all.deb ... 132s Unpacking python3-ufolib2 (0.17.1+dfsg1-1) ... 132s Selecting previously unselected package python3-zopfli. 132s Preparing to unpack .../202-python3-zopfli_0.4.0-1_s390x.deb ... 132s Unpacking python3-zopfli (0.4.0-1) ... 132s Selecting previously unselected package unicode-data. 132s Preparing to unpack .../203-unicode-data_16.0.0-1_all.deb ... 132s Unpacking unicode-data (16.0.0-1) ... 132s Selecting previously unselected package python3-fonttools. 132s Preparing to unpack .../204-python3-fonttools_4.57.0-2build1_s390x.deb ... 132s Unpacking python3-fonttools (4.57.0-2build1) ... 132s Selecting previously unselected package python3-kiwisolver. 132s Preparing to unpack .../205-python3-kiwisolver_1.4.10~rc0-1_s390x.deb ... 132s Unpacking python3-kiwisolver (1.4.10~rc0-1) ... 132s Selecting previously unselected package python3-matplotlib. 132s Preparing to unpack .../206-python3-matplotlib_3.10.7+dfsg1-1_s390x.deb ... 132s Unpacking python3-matplotlib (3.10.7+dfsg1-1) ... 132s Selecting previously unselected package python3-pyproj. 132s Preparing to unpack .../207-python3-pyproj_3.7.2-1_s390x.deb ... 132s Unpacking python3-pyproj (3.7.2-1) ... 132s Selecting previously unselected package python3-pyshp. 132s Preparing to unpack .../208-python3-pyshp_2.3.1-3_all.deb ... 132s Unpacking python3-pyshp (2.3.1-3) ... 132s Selecting previously unselected package python3-shapely. 132s Preparing to unpack .../209-python3-shapely_2.1.2-1_s390x.deb ... 132s Unpacking python3-shapely (2.1.2-1) ... 132s Selecting previously unselected package python3-cartopy. 132s Preparing to unpack .../210-python3-cartopy_0.25.0+dfsg-1_s390x.deb ... 132s Unpacking python3-cartopy (0.25.0+dfsg-1) ... 132s Selecting previously unselected package python3-cftime. 132s Preparing to unpack .../211-python3-cftime_1.6.5-1_s390x.deb ... 132s Unpacking python3-cftime (1.6.5-1) ... 132s Selecting previously unselected package python3-click. 132s Preparing to unpack .../212-python3-click_8.2.0+0.really.8.1.8-1_all.deb ... 132s Unpacking python3-click (8.2.0+0.really.8.1.8-1) ... 133s Selecting previously unselected package python3-cloudpickle. 133s Preparing to unpack .../213-python3-cloudpickle_3.1.1-1_all.deb ... 133s Unpacking python3-cloudpickle (3.1.1-1) ... 133s Selecting previously unselected package python3-comm. 133s Preparing to unpack .../214-python3-comm_0.2.1-1_all.deb ... 133s Unpacking python3-comm (0.2.1-1) ... 133s Selecting previously unselected package python3-coverage. 133s Preparing to unpack .../215-python3-coverage_7.8.2+dfsg1-1_s390x.deb ... 133s Unpacking python3-coverage (7.8.2+dfsg1-1) ... 133s Selecting previously unselected package python3-crc32c. 133s Preparing to unpack .../216-python3-crc32c_2.7.1-1build1_s390x.deb ... 133s Unpacking python3-crc32c (2.7.1-1build1) ... 133s Selecting previously unselected package python3-fsspec. 133s Preparing to unpack .../217-python3-fsspec_2025.3.2-1ubuntu1_all.deb ... 133s Unpacking python3-fsspec (2025.3.2-1ubuntu1) ... 133s Selecting previously unselected package python3-toolz. 133s Preparing to unpack .../218-python3-toolz_1.0.0-2_all.deb ... 133s Unpacking python3-toolz (1.0.0-2) ... 133s Selecting previously unselected package python3-locket. 133s Preparing to unpack .../219-python3-locket_1.0.0-2_all.deb ... 133s Unpacking python3-locket (1.0.0-2) ... 133s Selecting previously unselected package python3-partd. 133s Preparing to unpack .../220-python3-partd_1.4.2-1_all.deb ... 133s Unpacking python3-partd (1.4.2-1) ... 133s Selecting previously unselected package python3-dask. 133s Preparing to unpack .../221-python3-dask_2024.12.1+dfsg-2_all.deb ... 133s Unpacking python3-dask (2024.12.1+dfsg-2) ... 133s Selecting previously unselected package python3-debugpy. 133s Preparing to unpack .../222-python3-debugpy_1.8.12+ds-1ubuntu1_s390x.deb ... 133s Unpacking python3-debugpy (1.8.12+ds-1ubuntu1) ... 133s Selecting previously unselected package python3.13-doc. 133s Preparing to unpack .../223-python3.13-doc_3.13.9-1_all.deb ... 133s Unpacking python3.13-doc (3.13.9-1) ... 133s Selecting previously unselected package python3-doc. 133s Preparing to unpack .../224-python3-doc_3.13.7-2_all.deb ... 133s Unpacking python3-doc (3.13.7-2) ... 133s Selecting previously unselected package python3-donfig. 133s Preparing to unpack .../225-python3-donfig_0.8.1+dfsg-3_all.deb ... 133s Unpacking python3-donfig (0.8.1+dfsg-3) ... 133s Selecting previously unselected package python3-execnet. 133s Preparing to unpack .../226-python3-execnet_2.1.1-1_all.deb ... 133s Unpacking python3-execnet (2.1.1-1) ... 133s Selecting previously unselected package python3-fastjsonschema. 133s Preparing to unpack .../227-python3-fastjsonschema_2.21.1-1_all.deb ... 133s Unpacking python3-fastjsonschema (2.21.1-1) ... 133s Selecting previously unselected package python3-flexcache. 133s Preparing to unpack .../228-python3-flexcache_0.3-2_all.deb ... 133s Unpacking python3-flexcache (0.3-2) ... 133s Selecting previously unselected package python3-flexparser. 133s Preparing to unpack .../229-python3-flexparser_0.4-1_all.deb ... 133s Unpacking python3-flexparser (0.4-1) ... 133s Selecting previously unselected package python3-h5py-serial. 133s Preparing to unpack .../230-python3-h5py-serial_3.13.0-1ubuntu1_s390x.deb ... 133s Unpacking python3-h5py-serial (3.13.0-1ubuntu1) ... 133s Selecting previously unselected package python3-h5py. 133s Preparing to unpack .../231-python3-h5py_3.13.0-1ubuntu1_all.deb ... 133s Unpacking python3-h5py (3.13.0-1ubuntu1) ... 133s Selecting previously unselected package python3-h5netcdf. 133s Preparing to unpack .../232-python3-h5netcdf_1.6.1-1_all.deb ... 133s Unpacking python3-h5netcdf (1.6.1-1) ... 133s Selecting previously unselected package python3-sortedcontainers. 133s Preparing to unpack .../233-python3-sortedcontainers_2.4.0-2_all.deb ... 133s Unpacking python3-sortedcontainers (2.4.0-2) ... 133s Selecting previously unselected package python3-hypothesis. 133s Preparing to unpack .../234-python3-hypothesis_6.130.5-2_all.deb ... 133s Unpacking python3-hypothesis (6.130.5-2) ... 133s Selecting previously unselected package python3-iniconfig. 133s Preparing to unpack .../235-python3-iniconfig_2.1.0-1_all.deb ... 133s Unpacking python3-iniconfig (2.1.0-1) ... 133s Selecting previously unselected package python3-jupyter-core. 133s Preparing to unpack .../236-python3-jupyter-core_5.7.2-5_all.deb ... 133s Unpacking python3-jupyter-core (5.7.2-5) ... 133s Selecting previously unselected package python3-tornado. 133s Preparing to unpack .../237-python3-tornado_6.5.2-3_s390x.deb ... 133s Unpacking python3-tornado (6.5.2-3) ... 133s Selecting previously unselected package python3-zmq. 133s Preparing to unpack .../238-python3-zmq_27.1.0-1_s390x.deb ... 133s Unpacking python3-zmq (27.1.0-1) ... 133s Selecting previously unselected package python3-jupyter-client. 133s Preparing to unpack .../239-python3-jupyter-client_8.6.3-3_all.deb ... 133s Unpacking python3-jupyter-client (8.6.3-3) ... 133s Selecting previously unselected package python3-nest-asyncio. 133s Preparing to unpack .../240-python3-nest-asyncio_1.5.4-1_all.deb ... 133s Unpacking python3-nest-asyncio (1.5.4-1) ... 133s Selecting previously unselected package python3-ipykernel. 133s Preparing to unpack .../241-python3-ipykernel_6.29.5-2_all.deb ... 133s Unpacking python3-ipykernel (6.29.5-2) ... 133s Selecting previously unselected package python3-jupyter-console. 133s Preparing to unpack .../242-python3-jupyter-console_6.6.3-2_all.deb ... 133s Unpacking python3-jupyter-console (6.6.3-2) ... 133s Selecting previously unselected package python3-jupyterlab-pygments. 133s Preparing to unpack .../243-python3-jupyterlab-pygments_0.2.2-3_all.deb ... 133s Unpacking python3-jupyterlab-pygments (0.2.2-3) ... 133s Selecting previously unselected package python3-mistune. 133s Preparing to unpack .../244-python3-mistune_3.1.4-1_all.deb ... 133s Unpacking python3-mistune (3.1.4-1) ... 133s Selecting previously unselected package python3-nbformat. 133s Preparing to unpack .../245-python3-nbformat_5.9.1-1_all.deb ... 133s Unpacking python3-nbformat (5.9.1-1) ... 133s Selecting previously unselected package python3-nbclient. 133s Preparing to unpack .../246-python3-nbclient_0.8.0-2_all.deb ... 133s Unpacking python3-nbclient (0.8.0-2) ... 133s Selecting previously unselected package python3-tinycss2. 133s Preparing to unpack .../247-python3-tinycss2_1.4.0-2_all.deb ... 133s Unpacking python3-tinycss2 (1.4.0-2) ... 133s Selecting previously unselected package python3-pandocfilters. 133s Preparing to unpack .../248-python3-pandocfilters_1.5.1-1_all.deb ... 133s Unpacking python3-pandocfilters (1.5.1-1) ... 133s Selecting previously unselected package python3-nbconvert. 133s Preparing to unpack .../249-python3-nbconvert_7.16.6-1_all.deb ... 133s Unpacking python3-nbconvert (7.16.6-1) ... 133s Selecting previously unselected package python3-nbsphinx. 134s Preparing to unpack .../250-python3-nbsphinx_0.9.5+ds-1_all.deb ... 134s Unpacking python3-nbsphinx (0.9.5+ds-1) ... 134s Selecting previously unselected package python3-netcdf4. 134s Preparing to unpack .../251-python3-netcdf4_1.7.2-1build4_s390x.deb ... 134s Unpacking python3-netcdf4 (1.7.2-1build4) ... 134s Selecting previously unselected package python3-pydata-sphinx-theme. 134s Preparing to unpack .../252-python3-pydata-sphinx-theme_0.16.1+dfsg-3_all.deb ... 134s Unpacking python3-pydata-sphinx-theme (0.16.1+dfsg-3) ... 134s Selecting previously unselected package python3-numcodecs. 134s Preparing to unpack .../253-python3-numcodecs_0.16.3+ds-1_s390x.deb ... 134s Unpacking python3-numcodecs (0.16.3+ds-1) ... 134s Selecting previously unselected package python3-numpydoc. 134s Preparing to unpack .../254-python3-numpydoc_1.9.0-1_all.deb ... 134s Unpacking python3-numpydoc (1.9.0-1) ... 134s Selecting previously unselected package python3-pytz. 134s Preparing to unpack .../255-python3-pytz_2025.2-4_all.deb ... 134s Unpacking python3-pytz (2025.2-4) ... 134s Selecting previously unselected package python3-pandas-lib:s390x. 134s Preparing to unpack .../256-python3-pandas-lib_2.3.3+dfsg-1ubuntu1_s390x.deb ... 134s Unpacking python3-pandas-lib:s390x (2.3.3+dfsg-1ubuntu1) ... 134s Selecting previously unselected package python3-pandas. 134s Preparing to unpack .../257-python3-pandas_2.3.3+dfsg-1ubuntu1_all.deb ... 134s Unpacking python3-pandas (2.3.3+dfsg-1ubuntu1) ... 134s Selecting previously unselected package python3-pickleshare. 134s Preparing to unpack .../258-python3-pickleshare_0.7.5-5_all.deb ... 134s Unpacking python3-pickleshare (0.7.5-5) ... 134s Selecting previously unselected package python3-pint. 134s Preparing to unpack .../259-python3-pint_0.24.4-2_all.deb ... 134s Unpacking python3-pint (0.24.4-2) ... 134s Selecting previously unselected package python3-pip. 134s Preparing to unpack .../260-python3-pip_25.1.1+dfsg-1ubuntu2_all.deb ... 134s Unpacking python3-pip (25.1.1+dfsg-1ubuntu2) ... 134s Selecting previously unselected package python3-pluggy. 134s Preparing to unpack .../261-python3-pluggy_1.6.0-1_all.deb ... 134s Unpacking python3-pluggy (1.6.0-1) ... 134s Selecting previously unselected package python3-pooch. 134s Preparing to unpack .../262-python3-pooch_1.8.2-1_all.deb ... 134s Unpacking python3-pooch (1.8.2-1) ... 134s Selecting previously unselected package python3-pytest. 134s Preparing to unpack .../263-python3-pytest_8.3.5-2_all.deb ... 134s Unpacking python3-pytest (8.3.5-2) ... 134s Selecting previously unselected package python3-regex. 134s Preparing to unpack .../264-python3-regex_0.1.20250918-1_s390x.deb ... 134s Unpacking python3-regex (0.1.20250918-1) ... 134s Selecting previously unselected package python3-tomlkit. 134s Preparing to unpack .../265-python3-tomlkit_0.13.3-2_all.deb ... 134s Unpacking python3-tomlkit (0.13.3-2) ... 134s Selecting previously unselected package python3-pytest-mypy. 134s Preparing to unpack .../266-python3-pytest-mypy_3.2.0-2_all.deb ... 134s Unpacking python3-pytest-mypy (3.2.0-2) ... 134s Selecting previously unselected package python3-pytest-xdist. 134s Preparing to unpack .../267-python3-pytest-xdist_3.8.0-2_all.deb ... 134s Unpacking python3-pytest-xdist (3.8.0-2) ... 134s Selecting previously unselected package python3-seaborn. 134s Preparing to unpack .../268-python3-seaborn_0.13.2-5_all.deb ... 134s Unpacking python3-seaborn (0.13.2-5) ... 134s Selecting previously unselected package python3-setuptools-scm. 134s Preparing to unpack .../269-python3-setuptools-scm_8.2.1-3_all.deb ... 134s Unpacking python3-setuptools-scm (8.2.1-3) ... 134s Selecting previously unselected package python3-sphinx-book-theme. 134s Preparing to unpack .../270-python3-sphinx-book-theme_1.1.4-2_all.deb ... 134s Unpacking python3-sphinx-book-theme (1.1.4-2) ... 134s Selecting previously unselected package python3-sphinx-copybutton. 134s Preparing to unpack .../271-python3-sphinx-copybutton_0.5.2-3_all.deb ... 134s Unpacking python3-sphinx-copybutton (0.5.2-3) ... 134s Selecting previously unselected package python3-sphinx-design. 134s Preparing to unpack .../272-python3-sphinx-design_0.6.1-2_all.deb ... 134s Unpacking python3-sphinx-design (0.6.1-2) ... 134s Selecting previously unselected package python3-sphinx-gallery. 134s Preparing to unpack .../273-python3-sphinx-gallery_0.17.1-1_all.deb ... 134s Unpacking python3-sphinx-gallery (0.17.1-1) ... 134s Selecting previously unselected package python3-sphinx-inline-tabs. 134s Preparing to unpack .../274-python3-sphinx-inline-tabs_2023.4.21-3_all.deb ... 134s Unpacking python3-sphinx-inline-tabs (2023.4.21-3) ... 134s Selecting previously unselected package python3-sphinx-remove-toctrees. 134s Preparing to unpack .../275-python3-sphinx-remove-toctrees_1.0.0-1_all.deb ... 134s Unpacking python3-sphinx-remove-toctrees (1.0.0-1) ... 134s Selecting previously unselected package sphinx-rtd-theme-common. 134s Preparing to unpack .../276-sphinx-rtd-theme-common_3.0.2+dfsg-3_all.deb ... 134s Unpacking sphinx-rtd-theme-common (3.0.2+dfsg-3) ... 134s Selecting previously unselected package python3-sphinxcontrib.jquery. 134s Preparing to unpack .../277-python3-sphinxcontrib.jquery_4.1-6_all.deb ... 134s Unpacking python3-sphinxcontrib.jquery (4.1-6) ... 134s Selecting previously unselected package python3-sphinx-rtd-theme. 134s Preparing to unpack .../278-python3-sphinx-rtd-theme_3.0.2+dfsg-3_all.deb ... 134s Unpacking python3-sphinx-rtd-theme (3.0.2+dfsg-3) ... 134s Selecting previously unselected package python3-sphinxcontrib-mermaid. 134s Preparing to unpack .../279-python3-sphinxcontrib-mermaid_1.0.0-1_all.deb ... 134s Unpacking python3-sphinxcontrib-mermaid (1.0.0-1) ... 134s Selecting previously unselected package python3-sphinxext-opengraph. 134s Preparing to unpack .../280-python3-sphinxext-opengraph_0.12.0-1_all.deb ... 134s Unpacking python3-sphinxext-opengraph (0.12.0-1) ... 135s Selecting previously unselected package python3-sphinxext-rediraffe. 135s Preparing to unpack .../281-python3-sphinxext-rediraffe_0.3.0-1_all.deb ... 135s Unpacking python3-sphinxext-rediraffe (0.3.0-1) ... 135s Selecting previously unselected package python3-xarray. 135s Preparing to unpack .../282-python3-xarray_2025.03.1-8_all.deb ... 135s Unpacking python3-xarray (2025.03.1-8) ... 135s Selecting previously unselected package python3-zarr. 135s Preparing to unpack .../283-python3-zarr_3.1.3-1_all.deb ... 135s Unpacking python3-zarr (3.1.3-1) ... 135s Selecting previously unselected package tzdata-legacy. 135s Preparing to unpack .../284-tzdata-legacy_2025b-5ubuntu1_all.deb ... 135s Unpacking tzdata-legacy (2025b-5ubuntu1) ... 135s Selecting previously unselected package python-hypothesis-doc. 135s Preparing to unpack .../285-python-hypothesis-doc_6.130.5-2_all.deb ... 135s Unpacking python-hypothesis-doc (6.130.5-2) ... 135s Selecting previously unselected package python-scipy-doc. 135s Preparing to unpack .../286-python-scipy-doc_1.15.3-1ubuntu1_all.deb ... 135s Unpacking python-scipy-doc (1.15.3-1ubuntu1) ... 135s Setting up dh-python (6.20250414) ... 135s Setting up libgraphite2-3:s390x (1.3.14-2ubuntu1) ... 135s Setting up liblcms2-2:s390x (2.17-1) ... 135s Setting up python3-iniconfig (2.1.0-1) ... 135s Setting up python3-tornado (6.5.2-3) ... 136s Setting up libnorm1t64:s390x (1.5.9+dfsg-4) ... 136s Setting up libsharpyuv0:s390x (1.5.0-0.1) ... 136s Setting up python3-pure-eval (0.2.3-1) ... 136s Setting up node-lru-cache (10.0.1-3) ... 136s Setting up fonts-lato (2.015-1) ... 136s Setting up libjs-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 136s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 136s Setting up libsodium23:s390x (1.0.18-1build3) ... 136s Setting up proj-data (9.7.0-1) ... 136s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 136s Setting up libxrender1:s390x (1:0.9.12-1) ... 136s Setting up python3-parso (0.8.5-1) ... 136s Setting up libgeos3.13.1:s390x (3.13.1-1) ... 136s Setting up python3-lz4 (4.4.4+dfsg-3) ... 136s Setting up python3-defusedxml (0.7.1-3) ... 136s Setting up libarchive-zip-perl (1.68-1) ... 136s Setting up python3-asttokens (3.0.0-2) ... 136s Setting up python3-alabaster (0.7.16-0.1) ... 137s Setting up libgeos-c1t64:s390x (3.13.1-1) ... 137s Setting up fonts-lyx (2.4.4-2) ... 137s Setting up python3-mypy-extensions (1.1.0-1) ... 137s Setting up libdebhelper-perl (13.24.2ubuntu1) ... 137s Setting up python3-fsspec (2025.3.2-1ubuntu1) ... 137s Setting up libpython3.14-minimal:s390x (3.14.0-4) ... 137s Setting up x11-common (1:7.7+24ubuntu1) ... 137s Setting up libdeflate0:s390x (1.23-2) ... 137s Setting up m4 (1.4.20-2) ... 137s Setting up libqhull-r8.0:s390x (2020.2-7) ... 137s Setting up python3-coverage (7.8.2+dfsg1-1) ... 138s Setting up python3-pyshp (2.3.1-3) ... 138s Setting up node-cjs-module-lexer (1.2.3+dfsg-1) ... 138s Setting up python3-pytz (2025.2-4) ... 138s Setting up python3-sortedcontainers (2.4.0-2) ... 138s Setting up node-fortawesome-fontawesome-free (6.7.2+ds1-1) ... 138s Setting up python3-pandocfilters (1.5.1-1) ... 138s Setting up libgomp1:s390x (15.2.0-7ubuntu1) ... 138s Setting up python3-click (8.2.0+0.really.8.1.8-1) ... 138s Setting up libjs-requirejs (2.3.7+ds+~2.1.37-1) ... 138s Setting up fonts-open-sans (1.11-2) ... 138s Setting up python3-wheel (0.46.1-2) ... 139s Setting up libjbig0:s390x (2.1-6.1ubuntu2) ... 139s Setting up python3-webencodings (0.5.1-5) ... 139s Setting up python3-setuptools-scm (8.2.1-3) ... 139s Setting up libaec0:s390x (1.1.4-2) ... 139s Setting up python3-platformdirs (4.3.7-1) ... 139s Setting up python3-psutil (7.1.0-1ubuntu1) ... 139s Setting up libsource-highlight-common (3.1.9-4.3build1) ... 139s Setting up tzdata-legacy (2025b-5ubuntu1) ... 139s Setting up python3-cloudpickle (3.1.1-1) ... 140s Setting up libsnappy1v5:s390x (1.2.2-2) ... 140s Setting up python3-fs (2.4.16-9ubuntu1) ... 140s Setting up unicode-data (16.0.0-1) ... 140s Setting up python3-jupyterlab-pygments (0.2.2-3) ... 140s Setting up python3-roman (5.1-1) ... 140s Setting up libpgm-5.3-0t64:s390x (5.3.128~dfsg-2.1build1) ... 140s Setting up python3-decorator (5.2.1-2) ... 140s Setting up autotools-dev (20240727.1) ... 140s Setting up libblas3:s390x (3.12.1-7) ... 140s update-alternatives: using /usr/lib/s390x-linux-gnu/blas/libblas.so.3 to provide /usr/lib/s390x-linux-gnu/libblas.so.3 (libblas.so.3-s390x-linux-gnu) in auto mode 140s Setting up python3-flexparser (0.4-1) ... 140s Setting up python3-wcwidth (0.2.13+dfsg1-1) ... 141s Setting up python3-pyproject-hooks (1.2.0-1) ... 141s Setting up node-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 141s Setting up libzopfli1 (1.0.3-3) ... 141s Setting up libfreetype6:s390x (2.13.3+dfsg-1build1) ... 141s Setting up python3-accessible-pygments (0.0.5-2) ... 141s Setting up python3-typeshed (0.0~git20241223.ea91db2-4) ... 141s Setting up python3-executing (2.2.0-0.2) ... 141s Setting up python3-snowballstemmer (3.0.1-1) ... 142s Setting up node-balanced-match (2.0.0-1) ... 142s Setting up python-cartopy-data (0.25.0+dfsg-1) ... 142s Setting up python3-pooch (1.8.2-1) ... 142s Setting up node-brace-expansion (2.0.1+~1.1.0-2) ... 142s Setting up python3-nest-asyncio (1.5.4-1) ... 142s Setting up python3-brotli (1.1.0-2build6) ... 142s Setting up liblzf1:s390x (3.6-4) ... 142s Setting up python3-cycler (0.12.1-2) ... 142s Setting up libimagequant0:s390x (2.18.0-1build1) ... 142s Setting up fonts-dejavu-mono (2.37-8) ... 142s Setting up python3-kiwisolver (1.4.10~rc0-1) ... 142s Setting up libcares2:s390x (1.34.5-1) ... 142s Setting up libmpc3:s390x (1.3.1-2) ... 142s Setting up python3-numpy-dev:s390x (1:2.3.4+ds-3ubuntu1) ... 142s Setting up python3-mypy (1.15.0-5) ... 144s Setting up libtcl8.6:s390x (8.6.17+dfsg-1) ... 144s Setting up autopoint (0.23.2-1) ... 144s Setting up fonts-dejavu-core (2.37-8) ... 144s Setting up python3-pip (25.1.1+dfsg-1ubuntu2) ... 146s Setting up libjpeg-turbo8:s390x (2.1.5-4ubuntu2) ... 146s Setting up python3-regex (0.1.20250918-1) ... 146s Setting up python3-html5lib (1.2-2) ... 146s Setting up libbabeltrace1:s390x (1.5.11-4build3) ... 146s Setting up python3-pickleshare (0.7.5-5) ... 146s Setting up python3-crc32c (2.7.1-1build1) ... 146s Setting up python3-installer (0.7.0+dfsg1-3) ... 146s Setting up libgfortran5:s390x (15.2.0-7ubuntu1) ... 146s Setting up autoconf (2.72-3.1ubuntu1) ... 146s Setting up python3-pluggy (1.6.0-1) ... 147s Setting up libwebp7:s390x (1.5.0-0.1) ... 147s Setting up libubsan1:s390x (15.2.0-7ubuntu1) ... 147s Setting up python3-fastjsonschema (2.21.1-1) ... 147s Setting up dwz (0.16-2) ... 147s Setting up python3-traitlets (5.14.3+really5.14.3-1) ... 147s Setting up libasan8:s390x (15.2.0-7ubuntu1) ... 147s Setting up python-tinycss2-common (1.4.0-2) ... 147s Setting up libjson-perl (4.10000-1) ... 147s Setting up libxslt1.1:s390x (1.1.43-0.3) ... 147s Setting up libblosc1:s390x (1.21.5+ds-2) ... 147s Setting up debugedit (1:5.2-3) ... 147s Setting up mypy (1.15.0-5) ... 147s Setting up liblua5.4-0:s390x (5.4.8-1) ... 147s Setting up libopenjp2-7:s390x (2.5.3-2.1) ... 147s Setting up python3-toolz (1.0.0-2) ... 147s Setting up libharfbuzz0b:s390x (12.1.0-1) ... 147s Setting up python3-flexcache (0.3-2) ... 147s Setting up sgml-base (1.31+nmu1) ... 147s Setting up python3-donfig (0.8.1+dfsg-3) ... 148s Setting up libxss1:s390x (1:1.2.3-1build3) ... 148s Setting up node-minimatch (9.0.3-6) ... 148s Setting up pandoc-data (3.1.11.1-3build1) ... 148s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 148s Setting up python3-mpmath (1.3.0-2) ... 148s Setting up node-xtend (4.0.2-3) ... 148s Setting up libisl23:s390x (0.27-1) ... 148s Setting up python3-build (1.2.2-4) ... 148s Setting up python3-execnet (2.1.1-1) ... 149s Setting up python-matplotlib-data (3.10.7+dfsg1-1) ... 149s Setting up python3-tomlkit (0.13.3-2) ... 149s Setting up libwebpmux3:s390x (1.5.0-0.1) ... 149s Setting up python3-locket (1.0.0-2) ... 149s Setting up python3-mistune (3.1.4-1) ... 149s Setting up python3-stack-data (0.6.3-1) ... 149s Setting up python3-soupsieve (2.7-2) ... 149s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 149s Setting up sphinx-rtd-theme-common (3.0.2+dfsg-3) ... 149s Setting up python3.14-minimal (3.14.0-4) ... 150s Setting up libcc1-0:s390x (15.2.0-7ubuntu1) ... 150s Setting up python3-jupyter-core (5.7.2-5) ... 150s Setting up libsz2:s390x (1.1.4-2) ... 150s Setting up libitm1:s390x (15.2.0-7ubuntu1) ... 150s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 150s Setting up python3-imagesize (1.4.1-1) ... 150s Setting up libjpeg8:s390x (8c-2ubuntu11) ... 150s Setting up automake (1:1.18.1-2) ... 150s update-alternatives: using /usr/bin/automake-1.18 to provide /usr/bin/automake (automake) in auto mode 150s Setting up python3-prompt-toolkit (3.0.52-1) ... 151s Setting up libfile-stripnondeterminism-perl (1.15.0-1) ... 151s Setting up python3-partd (1.4.2-1) ... 151s Setting up python3-sympy (1.14.0-2) ... 163s /usr/lib/python3/dist-packages/sympy/testing/runtests.py:283: SyntaxWarning: 'return' in a 'finally' block 163s return p.returncode 163s Setting up liblapack3:s390x (3.12.1-7) ... 163s update-alternatives: using /usr/lib/s390x-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/s390x-linux-gnu/liblapack.so.3 (liblapack.so.3-s390x-linux-gnu) in auto mode 163s Setting up gettext (0.23.2-1) ... 163s Setting up python3-tinycss2 (1.4.0-2) ... 163s Setting up libgcc-15-dev:s390x (15.2.0-7ubuntu1) ... 163s Setting up libzmq5:s390x (4.3.5-1build2) ... 163s Setting up python3-jedi (0.19.1+ds1-1) ... 163s Setting up libpython3.14-stdlib:s390x (3.14.0-4) ... 163s Setting up pybuild-plugin-pyproject (6.20250414) ... 163s Setting up fontconfig-config (2.15.0-2.3ubuntu1) ... 163s Setting up python3-pytest (8.3.5-2) ... 164s Setting up libwebpdemux2:s390x (1.5.0-0.1) ... 164s Setting up python3-hypothesis (6.130.5-2) ... 164s Setting up python3-dask (2024.12.1+dfsg-2) ... 167s Setting up libsource-highlight4t64:s390x (3.1.9-4.3build1) ... 167s Setting up python3-nbformat (5.9.1-1) ... 167s Setting up python3-bs4 (4.13.4-3) ... 167s Setting up python3-zopfli (0.4.0-1) ... 167s Setting up intltool-debian (0.35.0+20060710.6) ... 167s Setting up python3-bleach (6.2.0-1) ... 167s Setting up python3-matplotlib-inline (0.1.7-1) ... 167s Setting up python3-comm (0.2.1-1) ... 168s Setting up python3-pint (0.24.4-2) ... 168s Setting up python3.13-doc (3.13.9-1) ... 168s Setting up gdb (16.3-1ubuntu2) ... 168s Setting up libstdc++-15-dev:s390x (15.2.0-7ubuntu1) ... 168s Setting up pandoc (3.1.11.1+ds-4) ... 168s Setting up python3-ipython (8.35.0-2) ... 169s /usr/lib/python3/dist-packages/IPython/core/interactiveshell.py:3141: SyntaxWarning: 'return' in a 'finally' block 169s return result 169s Setting up python3-zmq (27.1.0-1) ... 169s Setting up libraqm0:s390x (0.10.3-1) ... 169s Setting up python-scipy-doc (1.15.3-1ubuntu1) ... 169s Setting up python3-numpy (1:2.3.4+ds-3ubuntu1) ... 172s Setting up libjs-sphinxdoc (8.2.3-1ubuntu2) ... 172s Setting up dh-strip-nondeterminism (1.15.0-1) ... 172s Setting up libhdf5-310:s390x (1.14.5+repack-4) ... 172s Setting up python3-lxml:s390x (6.0.2-1) ... 172s Setting up libtiff6:s390x (4.7.0-3ubuntu3) ... 172s Setting up xml-core (0.19) ... 173s Setting up cpp-15-s390x-linux-gnu (15.2.0-7ubuntu1) ... 173s Setting up python3-pytest-mypy (3.2.0-2) ... 173s Setting up python3-jupyter-client (8.6.3-3) ... 173s Setting up python3-contourpy (1.3.1-2) ... 173s Setting up ipython3 (8.35.0-2) ... 173s Setting up libfontconfig1:s390x (2.15.0-2.3ubuntu1) ... 173s Setting up python3.14 (3.14.0-4) ... 174s Setting up gcc-15-s390x-linux-gnu (15.2.0-7ubuntu1) ... 174s Setting up python3-doc (3.13.7-2) ... 174s Setting up g++-15-s390x-linux-gnu (15.2.0-7ubuntu1) ... 174s Setting up libhdf5-hl-310:s390x (1.14.5+repack-4) ... 174s Setting up python3-shapely (2.1.2-1) ... 174s Setting up libxft2:s390x (2.3.6-1build1) ... 174s Setting up python-xarray-doc (2025.03.1-8) ... 174s Setting up python3-scipy (1.15.3-1ubuntu1) ... 178s /usr/lib/python3/dist-packages/scipy/optimize/_optimize.py:921: SyntaxWarning: 'break' in a 'finally' block 178s break 181s Setting up python3-pytest-xdist (3.8.0-2) ... 181s Setting up python-hypothesis-doc (6.130.5-2) ... 181s Setting up libproj25:s390x (9.7.0-1) ... 181s Setting up cpp-s390x-linux-gnu (4:15.2.0-4ubuntu1) ... 181s Setting up python-pandas-doc (2.3.3+dfsg-1ubuntu1) ... 181s Setting up po-debconf (1.0.21+nmu1) ... 181s Setting up libtk8.6:s390x (8.6.17-1) ... 181s Setting up python3-pandas-lib:s390x (2.3.3+dfsg-1ubuntu1) ... 181s Setting up libnetcdf22:s390x (1:4.9.3-1build1) ... 181s Setting up python3-h5py-serial (3.13.0-1ubuntu1) ... 181s Setting up python3-all (3.13.7-2) ... 181s Setting up python3-debugpy (1.8.12+ds-1ubuntu1) ... 182s Setting up python3-pyproj (3.7.2-1) ... 182s Setting up python3.13-tk (3.13.9-1) ... 182s Setting up python3-nbclient (0.8.0-2) ... 183s Setting up python3-pil:s390x (11.3.0-1ubuntu2) ... 183s Setting up python3-pandas (2.3.3+dfsg-1ubuntu1) ... 192s Setting up gcc-s390x-linux-gnu (4:15.2.0-4ubuntu1) ... 192s Setting up sphinx-common (8.2.3-1ubuntu2) ... 192s Setting up python3-ipykernel (6.29.5-2) ... 192s Setting up python3-h5py (3.13.0-1ubuntu1) ... 193s Setting up python3-bottleneck (1.4.2+ds1-2build2) ... 193s Setting up python3-cftime (1.6.5-1) ... 193s Setting up python3-nbconvert (7.16.6-1) ... 193s Setting up cpp-15 (15.2.0-7ubuntu1) ... 193s Setting up cpp (4:15.2.0-4ubuntu1) ... 193s Setting up python3-netcdf4 (1.7.2-1build4) ... 193s Setting up tk8.6-blt2.5 (2.5.3+dfsg-8) ... 193s Setting up python3.14-tk (3.14.0-4) ... 193s Setting up blt (2.5.3+dfsg-8) ... 193s Setting up python3-xarray (2025.03.1-8) ... 196s Setting up python3-tk:s390x (3.13.9-1) ... 196s Setting up g++-s390x-linux-gnu (4:15.2.0-4ubuntu1) ... 196s Setting up python3-jupyter-console (6.6.3-2) ... 196s Setting up gcc-15 (15.2.0-7ubuntu1) ... 196s Setting up python3-h5netcdf (1.6.1-1) ... 196s Setting up python3-pil.imagetk:s390x (11.3.0-1ubuntu2) ... 196s Setting up g++-15 (15.2.0-7ubuntu1) ... 196s Setting up libtool (2.5.4-7) ... 196s Setting up gcc (4:15.2.0-4ubuntu1) ... 196s Setting up dh-autoreconf (21) ... 196s Setting up g++ (4:15.2.0-4ubuntu1) ... 196s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 196s Setting up build-essential (12.12ubuntu1) ... 196s Setting up debhelper (13.24.2ubuntu1) ... 196s Setting up pybuild-plugin-autopkgtest (6.20250414) ... 196s Setting up python3-fonttools (4.57.0-2build1) ... 198s Setting up python3-ufolib2 (0.17.1+dfsg1-1) ... 198s Setting up node-acorn (8.8.1+ds+~cs25.17.7-2) ... 198s Setting up node-ms (2.1.3+~cs0.7.31-3) ... 198s Setting up node-semver (7.6.1+~7.5.8-2) ... 198s Setting up node-corepack (0.24.0-5) ... 198s Setting up python3-matplotlib (3.10.7+dfsg1-1) ... 201s Setting up python3-cartopy (0.25.0+dfsg-1) ... 201s Setting up python3-seaborn (0.13.2-5) ... 202s Setting up node-debug (4.4.1+~4.1.12-1) ... 202s Setting up node-llhttp (9.3.3~really9.3.0+~cs12.11.8-3) ... 202s Setting up node-undici (7.16.0+dfsg+~cs3.2.0-2) ... 202s Setting up libnode115:s390x (20.19.4+dfsg-1) ... 202s Setting up nodejs (20.19.4+dfsg-1) ... 202s update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode 202s Setting up node-argparse (2.0.1-2) ... 202s Setting up node-esprima (4.0.1+ds+~4.0.3-2) ... 202s Setting up node-js-yaml (4.1.0+dfsg+~4.0.5-7) ... 202s Setting up python-dask-doc (2024.12.1+dfsg-2) ... 202s Processing triggers for install-info (7.2-5) ... 202s Processing triggers for libc-bin (2.42-2ubuntu2) ... 202s Processing triggers for systemd (257.9-0ubuntu2) ... 202s Processing triggers for man-db (2.13.1-1) ... 203s Processing triggers for sgml-base (1.31+nmu1) ... 203s Setting up docutils-common (0.21.2+dfsg-2) ... 203s Processing triggers for sgml-base (1.31+nmu1) ... 203s Setting up python3-docutils (0.21.2+dfsg-2) ... 204s Setting up python3-sphinx (8.2.3-1ubuntu2) ... 205s Setting up python3-sphinx-gallery (0.17.1-1) ... 205s Setting up python3-sphinx-copybutton (0.5.2-3) ... 205s Setting up python3-sphinx-design (0.6.1-2) ... 206s Setting up python3-nbsphinx (0.9.5+ds-1) ... 206s Setting up python3-sphinxext-rediraffe (0.3.0-1) ... 206s Setting up python3-sphinxcontrib-mermaid (1.0.0-1) ... 206s Setting up python3-sphinxcontrib.jquery (4.1-6) ... 206s Setting up python3-numpydoc (1.9.0-1) ... 206s Setting up python3-pydata-sphinx-theme (0.16.1+dfsg-3) ... 207s Setting up python3-sphinxext-opengraph (0.12.0-1) ... 207s Setting up python3-autodocsumm (0.2.14-2) ... 207s Setting up python3-sphinx-remove-toctrees (1.0.0-1) ... 207s Setting up python3-sphinx-inline-tabs (2023.4.21-3) ... 207s Setting up python3-sphinx-book-theme (1.1.4-2) ... 207s Setting up python3-sphinx-rtd-theme (3.0.2+dfsg-3) ... 207s Setting up python3-numcodecs (0.16.3+ds-1) ... 208s Setting up python3-zarr (3.1.3-1) ... 209s autopkgtest [11:01:39]: test pybuild-autopkgtest: pybuild-autopkgtest 209s autopkgtest [11:01:39]: test pybuild-autopkgtest: [----------------------- 209s pybuild-autopkgtest 210s I: pybuild base:311: cd /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build; python3.14 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 220s ============================= test session starts ============================== 220s platform linux -- Python 3.14.0, pytest-8.3.5, pluggy-1.6.0 220s rootdir: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build 220s configfile: pyproject.toml 220s plugins: hypothesis-6.130.5, typeguard-4.4.2, zarr-3.1.3, mypy-plugins-3.2.0, xdist-3.8.0 220s collected 21888 items / 51 deselected / 4 skipped / 21837 selected 220s 220s tests/test_accessor_dt.py .............................................. [ 0%] 220s ........................................................................ [ 0%] 221s ........................................................................ [ 0%] 222s ........................................................................ [ 1%] 222s ........................................................................ [ 1%] 222s .................... [ 1%] 222s tests/test_accessor_str.py ............................................. [ 1%] 223s ........................................................................ [ 2%] 223s ........................................................................ [ 2%] 223s ...................................... [ 2%] 223s tests/test_assertions.py .............................. [ 2%] 223s tests/test_backends.py .ssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 223s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 223s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 224s ssssssssssssssssssssssss.................s...............XxXsXsssss..... [ 4%] 227s ..s..................Fs........s.s.................ss................... [ 4%] 230s ..........................................................s............. [ 4%] 234s ..XxXsXsssss.......s..................Fs........s.s.................ss.. [ 5%] 238s ........................................................................ [ 5%] 242s ...s...............XxXsXsssss.......s..................Fs........s.s.... [ 5%] 246s .............ss......................................................... [ 5%] 255s .....FFF.......s..............FFFFF...F.....Fs....FFFFFFFFF..xxxsxsssssF [ 6%] 267s FFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ssFFFFFFFFFFFFFFFFF [ 6%] 282s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF...F.....Fs....FFFFF [ 6%] 295s FFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ss [ 7%] 310s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF... [ 7%] 323s F.....Fs....FFFFFFFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss. [ 7%] 340s FFFF...F....F..ssFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.F [ 8%] 349s F.FFF...FFFFFFFFFF.s..FF.F.F.FFFFFs..................s...............XxX [ 8%] 351s sXXxXsX.......s.s................................s...............XxXsXXx [ 8%] 352s XsX.......s.s...............ss.................s...............XxXsXXxXs [ 9%] 353s X.......s.s................F.sssssssssssssssssssssssssssssssssssssssssss [ 9%] 353s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 9%] 365s sssssssssssssssssssssss.FFFFFFFFFFFFFFFsFFFFFFFFFFFFF.FxxxsxxxxsxFFFFFFF [ 10%] 370s sFs.FFFFFFFFFFF.FF...Fssssssssssssssssssssssssssssssssssssssssssssssssss [ 10%] 370s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 10%] 370s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 370s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 370s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 370s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssFF [ 12%] 379s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFssssssssssssssssssssssssssssssssss [ 12%] 382s sssssssssssssssssssssssssssssssss.sxsFFFF.F.s..s..s..s.sss.FFsFFFFFFFFFF [ 12%] 394s FFFFFFFFFFFFFFFFFFFFFFxxxFFFFFFFFFFFFFFFFFFFF....ssFFFFFFFFFFFFs.sssssss [ 13%] 394s s [ 13%] 394s tests/test_backends_api.py s....................... [ 13%] 394s tests/test_backends_common.py ... [ 13%] 396s tests/test_backends_datatree.py sssssssssssssssss.F.FFF.F.......F.F.F.F. [ 13%] 397s F.F.F.F...... [ 13%] 400s tests/test_backends_file_manager.py ............................... [ 13%] 400s tests/test_backends_locks.py . [ 13%] 400s tests/test_backends_lru_cache.py ........ [ 13%] 402s tests/test_calendar_ops.py ........................... [ 13%] 402s tests/test_cftime_offsets.py ........................................... [ 14%] 402s ........................................................................ [ 14%] 402s ........................................................................ [ 14%] 402s ........................................................................ [ 15%] 402s ........................................................................ [ 15%] 402s ........................................................................ [ 15%] 402s ........................................................................ [ 16%] 402s ........................................................................ [ 16%] 402s ........................................................................ [ 16%] 402s ........................................................................ [ 17%] 403s ........................................................................ [ 17%] 403s ........................................................................ [ 17%] 403s ........................................................................ [ 18%] 403s ........................................................................ [ 18%] 403s ........................................................................ [ 18%] 403s ........................................................................ [ 19%] 403s ........................................................................ [ 19%] 403s ........................................................................ [ 19%] 403s ........................................................................ [ 20%] 403s ........................................................................ [ 20%] 403s ........................................................................ [ 20%] 403s ........................................................................ [ 21%] 403s ........................................................................ [ 21%] 403s ........................................................................ [ 21%] 403s ........................................................................ [ 22%] 403s ........................................................................ [ 22%] 403s ........................................................................ [ 22%] 403s ........................................................................ [ 23%] 403s ........................................................................ [ 23%] 403s ........................................................................ [ 23%] 403s ........................................................................ [ 24%] 404s ........................................................................ [ 24%] 404s ........................................................................ [ 24%] 404s ........................................................................ [ 24%] 404s ........................................................................ [ 25%] 404s ........................................................................ [ 25%] 404s ........................................................................ [ 25%] 404s ........................................................................ [ 26%] 404s ........................................................................ [ 26%] 404s .............ssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 26%] 404s .ssss....ssss....ssss....ssss.................................. [ 27%] 404s tests/test_cftimeindex.py .............................................. [ 27%] 404s ........................................................................ [ 27%] 404s ........................................................................ [ 28%] 404s ........................................................................ [ 28%] 404s ........................................................................ [ 28%] 404s ........................................................................ [ 29%] 405s ........................................................................ [ 29%] 405s ........................................................................ [ 29%] 405s ........................................................................ [ 30%] 405s ........................................................................ [ 30%] 405s ........................................................................ [ 30%] 405s ........................................................................ [ 31%] 406s ...........................................x............................ [ 31%] 406s ........................................................................ [ 31%] 406s ................................................ [ 31%] 406s tests/test_cftimeindex_resample.py ..................................... [ 32%] 407s ........................................................................ [ 32%] 408s ........................................................................ [ 32%] 408s ........................................................................ [ 33%] 409s ........................................................................ [ 33%] 410s ........................................................................ [ 33%] 410s ........................................................................ [ 34%] 411s ................................................ [ 34%] 411s tests/test_coarsen.py .................................................. [ 34%] 412s ........................................................................ [ 34%] 412s ..........s.......s.......s.......s.......s.......s.......s.......s..... [ 35%] 412s .... [ 35%] 412s tests/test_coding.py ............................... [ 35%] 412s tests/test_coding_strings.py ....................... [ 35%] 412s tests/test_coding_times.py ............................................. [ 35%] 412s ........................................................................ [ 36%] 413s ........................................................................ [ 36%] 413s ........................................................................ [ 36%] 413s ........................................................................ [ 37%] 413s ........................................................................ [ 37%] 413s ........................................................................ [ 37%] 413s ........................................................................ [ 38%] 413s ........................................................................ [ 38%] 413s ........................................................................ [ 38%] 414s ...................s.................................................... [ 39%] 414s ........................................................................ [ 39%] 414s ........................................................................ [ 39%] 414s ......................................ssssssss......s......s......s..... [ 39%] 415s .s......s............................................................... [ 40%] 415s .......................................................... [ 40%] 415s tests/test_combine.py .......................................x.......... [ 40%] 416s ...................................................... [ 41%] 416s tests/test_computation.py .............................................. [ 41%] 417s ........................................................................ [ 41%] 419s ........................................................................ [ 41%] 421s ........................................................................ [ 42%] 421s ..................................XxXx. [ 42%] 422s tests/test_concat.py ................................................... [ 42%] 422s ................................................. [ 42%] 422s tests/test_conventions.py .................................sssssssssssss [ 43%] 422s ssssssssssssssssssssssssssssssssssssssssssssssssssssss........ [ 43%] 422s tests/test_coordinate_transform.py ............ [ 43%] 422s tests/test_coordinates.py ...................... [ 43%] 424s tests/test_dask.py ..................................................... [ 43%] 435s ..........XXx.X......................................................... [ 44%] 436s .......................................................F................ [ 44%] 437s ...................... [ 44%] 437s tests/test_dataarray.py ................................................ [ 44%] 438s ........................................................................ [ 45%] 438s ........................................................................ [ 45%] 439s ........................................................................ [ 45%] 439s s...ss......................................Xx.......................... [ 46%] 440s ..........................ss....ss...................................... [ 46%] 442s ............x.....................................x.......x............. [ 46%] 443s ................sssssssssssss.................ss...... [ 47%] 503s tests/test_dataarray_typing.yml .............. [ 47%] 505s tests/test_dataset.py .................................................. [ 47%] 506s ........................................................................ [ 47%] 506s ......Xx...................................................s............ [ 47%] 507s ..............................................s......................... [ 48%] 507s ........................................................................ [ 48%] 508s ...............................................................ss....ss. [ 48%] 510s ......................................................................ss [ 49%] 510s ... [ 49%] 550s tests/test_dataset_typing.yml .............. [ 49%] 550s tests/test_datatree.py ............................xx..........x......x. [ 49%] 550s ........................................................................ [ 49%] 550s ........x.......... [ 49%] 550s tests/test_datatree_mapping.py .............x........ [ 50%] 590s tests/test_datatree_typing.yml .............. [ 50%] 590s tests/test_deprecation_helpers.py .. [ 50%] 590s tests/test_dtypes.py ................................................... [ 50%] 590s ...sss... [ 50%] 590s tests/test_duck_array_ops.py ......s...........s........................ [ 50%] 591s ..................................................................s..... [ 50%] 591s ..................................ss..............ss..............ss.... [ 51%] 592s ..ss......ss..............ss............................................ [ 51%] 594s ..........ss......ss..............................ss..............ss.... [ 51%] 595s ..........ss......ss......ss..............ss............................ [ 52%] 596s ..........................ss......ss................ssssssssss.......... [ 52%] 596s ssssssssss..........ssssssssss..........ssssssssss..........ssssss...... [ 52%] 597s ........ssssss..............ssssss..............ssssss..............ssss [ 53%] 597s sssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s. [ 53%] 597s 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%] 598s s.s.s.s.s.s............................................................. [ 54%] 599s ........................................................................ [ 54%] 600s ........................................................................ [ 54%] 600s ........................................................................ [ 55%] 601s ........................................................................ [ 55%] 602s ........................................................................ [ 55%] 605s ........................................................ [ 56%] 605s tests/test_duck_array_wrapping.py s.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.sxss.s [ 56%] 605s .ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.s.ssXsxss.sxss.sxss.sxss.s.ss.s.s [ 56%] 606s sxsxssxsxssxsxss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.sxssxsxss.s.ss.s.ss. [ 57%] 606s sxss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ssXsxss.s.ss.sxss.sx [ 57%] 606s ss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss [ 57%] 606s .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%] 607s 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%] 607s s.s.ss.s.ss.s.ss.s.s [ 58%] 607s tests/test_error_messages.py .. [ 58%] 607s tests/test_extensions.py .... [ 58%] 607s tests/test_formatting.py .....................................s......... [ 58%] 607s ..... [ 58%] 607s tests/test_formatting_html.py ........................ [ 58%] 608s tests/test_groupby.py ......................s........................... [ 59%] 609s ...............................ss....................................... [ 59%] 611s ........................................................................ [ 59%] 612s .............................................................sssssssss.. [ 60%] 612s ..s..............sssssssssss............. [ 60%] 612s tests/test_hashable.py ........ [ 60%] 612s tests/test_indexes.py .................................................. [ 60%] 613s ........................ [ 60%] 613s tests/test_indexing.py ................................................. [ 60%] 613s ........................................................................ [ 61%] 613s ............... [ 61%] 622s tests/test_interp.py ................................................... [ 61%] 628s .x...................................................................... [ 61%] 640s ................................................................sss..sss [ 62%] 654s ..sss..sss..sss..sss..sss..sss............... [ 62%] 654s tests/test_merge.py .................................................... [ 62%] 654s ... [ 62%] 656s tests/test_missing.py .................................................. [ 62%] 657s ..................s...........................................x.. [ 63%] 657s tests/test_namedarray.py ....x...........................s.............. [ 63%] 657s .. [ 63%] 657s tests/test_nputils.py .. [ 63%] 657s tests/test_options.py ................... [ 63%] 658s tests/test_pandas_to_xarray.py xxxxxxxxxxxxxxxxxxxxxxxsxxxxxx........... [ 63%] 658s ....................... [ 63%] 658s tests/test_parallelcompat.py ............... [ 63%] 660s tests/test_plot.py ..................................................... [ 63%] 662s ........................................................................ [ 64%] 667s ........................................................................ [ 64%] 670s ...............................................s........................ [ 64%] 674s .............X.......................................................x.. [ 65%] 694s ss.ssss................................................................. [ 65%] 696s .......sss.............................................................. [ 65%] 696s .......................................... [ 66%] 697s tests/test_plugins.py ...........F. [ 66%] 697s tests/test_print_versions.py . [ 66%] 701s tests/test_rolling.py .................................................. [ 66%] 703s ........................................................................ [ 66%] 705s ........................................................................ [ 67%] 706s ........................................................................ [ 67%] 709s ........................................................................ [ 67%] 710s ........................................................................ [ 68%] 711s ........................................................................ [ 68%] 711s ........................................................................ [ 68%] 711s ........................................................................ [ 69%] 712s ........................................................................ [ 69%] 714s ........................................................................ [ 69%] 718s ........................................................................ [ 70%] 720s ........................................................................ [ 70%] 723s ........................................................................ [ 70%] 724s ........................................................................ [ 71%] 724s ........................................................................ [ 71%] 724s ........................................................................ [ 71%] 725s ........................................................................ [ 72%] 728s ........................................................................ [ 72%] 730s ........................................................................ [ 72%] 733s ........................................................................ [ 73%] 733s ........................................................................ [ 73%] 733s ........................................................................ [ 73%] 734s ........................................................................ [ 74%] 735s ........................................................................ [ 74%] 738s ........................................................................ [ 74%] 742s ........................................................................ [ 75%] 744s ........................................................................ [ 75%] 745s ........................................................................ [ 75%] 745s ........................................................................ [ 76%] 746s ........................................................................ [ 76%] 750s ........................................................................ [ 76%] 753s ...........ssssssssssssssssssssssssssssssssssssssssss................... [ 77%] 753s ........................................................................ [ 77%] 754s ........................................................................ [ 77%] 754s ........................................................................ [ 78%] 755s ........................................................................ [ 78%] 755s ........................................................................ [ 78%] 756s ........................................................ssssssssssssssss [ 78%] 756s ........................................................................ [ 79%] 757s ........................................................................ [ 79%] 757s ........................................................................ [ 79%] 758s ........................................................................ [ 80%] 760s ........................................................................ [ 80%] 764s ........................................................................ [ 80%] 768s ssssssssssssssss........................................................ [ 81%] 772s ........................................................................ [ 81%] 775s ........................................................................ [ 81%] 779s ........................................................................ [ 82%] 784s ........................................................................ [ 82%] 784s ........sss [ 82%] 797s tests/test_strategies.py ..................... [ 82%] 798s tests/test_treenode.py .................................. [ 82%] 801s tests/test_tutorial.py xxss [ 82%] 801s tests/test_typed_ops.py ..... [ 82%] 801s tests/test_ufuncs.py ................................................... [ 83%] 801s .......................................................................x [ 83%] 801s .. [ 83%] 803s tests/test_units.py .s..s..s..s......sssssxxxxx.....sssss.xxxx.....sssss [ 83%] 805s xxxxx.....sssss.xxxx.....sssssxxxxx.....sssss.xxxx.....sssssxxxxx.....ss [ 84%] 806s sss.xxxx.........sssss..........sssss..........sssss..........sssss..... [ 84%] 806s .....sssss..........sssss..........sssss..........sssss..........sssss.. [ 84%] 807s ........sssss..........sssss..........sssss......s..s..s..s..s..s..s..s. [ 85%] 808s .sx.sx.sx.sx............................................................ [ 85%] 808s ........................................................................ [ 85%] 808s ...................ssssssssss..........ssssssssss....................... [ 86%] 809s ........................................................................ [ 86%] 809s ...................................ss..XX............ss..XX............. [ 86%] 809s ........................................................................ [ 87%] 809s .....................s..s..ss....ss......ss..s.......................ss. [ 87%] 810s .s...................................................................... [ 87%] 818s ....x....x......................xxxxx.....xxxxx.x.x.x.x.x.x.x.x.x.x..... [ 88%] 819s .xxxx................................................................... [ 88%] 820s ...............x...............sssss.....sssssssssssssss.....sssss.....s [ 88%] 820s ssssssssssssss.....sssss..........sssss..................s..s..s..s.ssss [ 89%] 820s ss.s..s..s..s..s..s..s..s.ssssss.s..s..s..s...........ssssssssssssssssss [ 89%] 820s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 89%] 823s ........................................................xx..xx..ssssssss [ 90%] 826s ssssssssssssxx..xx..ssssssssssssssssssss......ss....s......s..s.s.s.s.s. [ 90%] 826s s...ss....ss....ss....ss....ss....ss....ss....ss...s..s..s.xs.sss.s..s.. [ 90%] 827s s..s.xs.sss.s.....ss....ss....ss....ss....ss....ss....ss....ss.......sss [ 91%] 827s ss..........sssss.......ss....ss........................................ [ 91%] 829s ....................xxxx................................................ [ 91%] 830s ..................................xx.....sssss.....sssss.....sssss.....s [ 92%] 831s ssssssssssssss.....sssss.....sssssssssssssss.....sssss.....sssss........ [ 92%] 831s .......sss...sssxx....s......s......ssssssssssssssssssssssssssssssssssss [ 92%] 831s ssssssssssssssssssssssssssssssssssssssssssssssssssssss...sss......sss... [ 93%] 833s ..................................................xx..xx..ssssssssssssss [ 93%] 835s ssssssxx..xx..ssssssssssssssssssss............ssssssssssss.............. [ 93%] 837s ..........ssssssssssss...............xx.ssssss...Xx....xx.ssssss...Xx..s [ 93%] 838s ..s...........ssssssssss....................ssssssssss.................. [ 94%] 838s s.....ssssssssssssss........s.............s.....ssssssssssssss........s. [ 94%] 840s .........sssss..........sssss.......x.x.x.... [ 94%] 840s tests/test_utils.py .................................................... [ 95%] 840s .............. [ 95%] 840s tests/test_variable.py ................................................. [ 95%] 840s ........................................................................ [ 95%] 840s ........................................................................ [ 96%] 840s ........................................................................ [ 96%] 841s ........................................................................ [ 96%] 850s .................ssss...............x.xX.......xX.......xx.......xx..... [ 97%] 851s ..xx.......s............................................................ [ 97%] 851s ........................ssssssssssssssssssssssssssssssssssssssssssssssss [ 97%] 851s sssssss..........................ssss....................... [ 97%] 852s tests/test_weighted.py ................................................. [ 98%] 852s ........................................................ssssssssssssssss [ 98%] 852s ssssssssssssssssssssssssssssssssssssssssssssssssssssssss................ [ 98%] 854s ........................................................................ [ 99%] 855s ........................................................................ [ 99%] 858s ........................................................................ [ 99%] 860s ................................... [100%] 860s 860s =================================== FAILURES =================================== 860s _________________ TestZarrDictStore.test_non_existent_store[2] _________________ 860s 860s self = 860s 860s def test_non_existent_store(self) -> None: 860s with pytest.raises( 860s FileNotFoundError, match="(No such file or directory|Unable to find group)" 860s ): 860s > xr.open_zarr(f"{uuid.uuid4()}") 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 860s ds = open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 860s store = ZarrStore.open_group( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 860s ) = _get_open_params( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 860s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 860s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 860s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 860s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 860s raise return_result 860s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 860s return await coro 860s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 860s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 860s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 860s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 860s store = await make_store(store_like, mode=mode, storage_options=storage_options) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 860s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 860s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 860s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 860s await store._open() 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/85925a1e-619c-4ccb-a828-3b4f6053a123') 860s 860s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 860s if not self.read_only: 860s self.root.mkdir(parents=True, exist_ok=True) 860s 860s if not self.root.exists(): 860s > raise FileNotFoundError(f"{self.root} does not exist") 860s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/85925a1e-619c-4ccb-a828-3b4f6053a123 does not exist 860s 860s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 860s 860s During handling of the above exception, another exception occurred: 860s 860s self = 860s 860s def test_non_existent_store(self) -> None: 860s > with pytest.raises( 860s FileNotFoundError, match="(No such file or directory|Unable to find group)" 860s ): 860s E AssertionError: Regex pattern did not match. 860s E Regex: '(No such file or directory|Unable to find group)' 860s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/85925a1e-619c-4ccb-a828-3b4f6053a123 does not exist' 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 860s ______________ TestZarrDirectoryStore.test_non_existent_store[2] _______________ 860s 860s self = 860s 860s def test_non_existent_store(self) -> None: 860s with pytest.raises( 860s FileNotFoundError, match="(No such file or directory|Unable to find group)" 860s ): 860s > xr.open_zarr(f"{uuid.uuid4()}") 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 860s ds = open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 860s store = ZarrStore.open_group( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 860s ) = _get_open_params( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 860s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 860s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 860s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 860s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 860s raise return_result 860s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 860s return await coro 860s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 860s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 860s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 860s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 860s store = await make_store(store_like, mode=mode, storage_options=storage_options) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 860s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 860s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 860s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 860s await store._open() 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ef2588e2-1d0a-4d3a-b5e5-e7f57c8ded34') 860s 860s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 860s if not self.read_only: 860s self.root.mkdir(parents=True, exist_ok=True) 860s 860s if not self.root.exists(): 860s > raise FileNotFoundError(f"{self.root} does not exist") 860s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ef2588e2-1d0a-4d3a-b5e5-e7f57c8ded34 does not exist 860s 860s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 860s 860s During handling of the above exception, another exception occurred: 860s 860s self = 860s 860s def test_non_existent_store(self) -> None: 860s > with pytest.raises( 860s FileNotFoundError, match="(No such file or directory|Unable to find group)" 860s ): 860s E AssertionError: Regex pattern did not match. 860s E Regex: '(No such file or directory|Unable to find group)' 860s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ef2588e2-1d0a-4d3a-b5e5-e7f57c8ded34 does not exist' 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 860s ________________ TestZarrWriteEmpty.test_non_existent_store[2] _________________ 860s 860s self = 860s 860s def test_non_existent_store(self) -> None: 860s with pytest.raises( 860s FileNotFoundError, match="(No such file or directory|Unable to find group)" 860s ): 860s > xr.open_zarr(f"{uuid.uuid4()}") 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 860s ds = open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 860s store = ZarrStore.open_group( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 860s ) = _get_open_params( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 860s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 860s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 860s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 860s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 860s raise return_result 860s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 860s return await coro 860s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 860s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 860s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 860s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 860s store = await make_store(store_like, mode=mode, storage_options=storage_options) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 860s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 860s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 860s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 860s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 860s await store._open() 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ad961866-2065-4705-ba8a-7c707f74bc33') 860s 860s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 860s if not self.read_only: 860s self.root.mkdir(parents=True, exist_ok=True) 860s 860s if not self.root.exists(): 860s > raise FileNotFoundError(f"{self.root} does not exist") 860s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ad961866-2065-4705-ba8a-7c707f74bc33 does not exist 860s 860s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 860s 860s During handling of the above exception, another exception occurred: 860s 860s self = 860s 860s def test_non_existent_store(self) -> None: 860s > with pytest.raises( 860s FileNotFoundError, match="(No such file or directory|Unable to find group)" 860s ): 860s E AssertionError: Regex pattern did not match. 860s E Regex: '(No such file or directory|Unable to find group)' 860s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ad961866-2065-4705-ba8a-7c707f74bc33 does not exist' 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 860s _______________ TestZarrWriteEmpty.test_write_empty[2-True-True] _______________ 860s 860s self = 860s consolidated = True, write_empty = True 860s 860s @pytest.mark.parametrize("consolidated", [True, False, None]) 860s @pytest.mark.parametrize("write_empty", [True, False, None]) 860s def test_write_empty( 860s self, 860s consolidated: bool | None, 860s write_empty: bool | None, 860s ) -> None: 860s def assert_expected_files(expected: list[str], store: str) -> None: 860s """Convenience for comparing with actual files written""" 860s ls = [] 860s test_root = os.path.join(store, "test") 860s for root, _, files in os.walk(test_root): 860s ls.extend( 860s [ 860s os.path.join(root, f).removeprefix(test_root).lstrip("/") 860s for f in files 860s ] 860s ) 860s 860s assert set(expected) == set( 860s [ 860s file.lstrip("c/") 860s for file in ls 860s if (file not in (".zattrs", ".zarray", "zarr.json")) 860s ] 860s ) 860s 860s # The zarr format is set by the `default_zarr_format` 860s # pytest fixture that acts on a superclass 860s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 860s if (write_empty is False) or (write_empty is None and has_zarr_v3): 860s expected = ["0.1.0"] 860s else: 860s expected = [ 860s "0.0.0", 860s "0.0.1", 860s "0.1.0", 860s "0.1.1", 860s ] 860s 860s if zarr_format_3: 860s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 860s # transform to the path style of zarr 3 860s # e.g. 0/0/1 860s expected = [e.replace(".", "/") for e in expected] 860s else: 860s # use nan for default fill_value behaviour 860s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 860s 860s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 860s 860s if has_dask: 860s ds["test"] = ds["test"].chunk(1) 860s encoding = None 860s else: 860s encoding = {"test": {"chunks": (1, 1, 1)}} 860s 860s with self.temp_dir() as (d, store): 860s ds.to_zarr( 860s store, 860s mode="w", 860s encoding=encoding, 860s write_empty_chunks=write_empty, 860s ) 860s 860s # check expected files after a write 860s assert_expected_files(expected, store) 860s 860s with self.roundtrip_dir( 860s ds, 860s store, 860s save_kwargs={ 860s "mode": "a", 860s "append_dim": "Z", 860s "write_empty_chunks": write_empty, 860s }, 860s ) as a_ds: 860s expected_ds = xr.concat([ds, ds], dim="Z") 860s 860s assert_identical(a_ds, expected_ds.compute()) 860s # add the new files we expect to be created by the append 860s # that was performed by the roundtrip_dir 860s if (write_empty is False) or (write_empty is None and has_zarr_v3): 860s expected.append("1.1.0") 860s else: 860s if not has_zarr_v3: 860s # TODO: remove zarr3 if once zarr issue is fixed 860s # https://github.com/zarr-developers/zarr-python/issues/2931 860s expected.extend( 860s [ 860s "1.1.0", 860s "1.0.0", 860s "1.0.1", 860s "1.1.1", 860s ] 860s ) 860s else: 860s expected.append("1.1.0") 860s if zarr_format_3: 860s expected = [e.replace(".", "/") for e in expected] 860s > assert_expected_files(expected, store) 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 860s store = '/tmp/tmpdhto5aoc/test.zarr' 860s 860s def assert_expected_files(expected: list[str], store: str) -> None: 860s """Convenience for comparing with actual files written""" 860s ls = [] 860s test_root = os.path.join(store, "test") 860s for root, _, files in os.walk(test_root): 860s ls.extend( 860s [ 860s os.path.join(root, f).removeprefix(test_root).lstrip("/") 860s for f in files 860s ] 860s ) 860s 860s > assert set(expected) == set( 860s [ 860s file.lstrip("c/") 860s for file in ls 860s if (file not in (".zattrs", ".zarray", "zarr.json")) 860s ] 860s ) 860s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 860s E 860s E Extra items in the right set: 860s E '1.0.0' 860s E '1.0.1' 860s E '1.1.1' 860s E Use -v to get more diff 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 860s ______________ TestZarrWriteEmpty.test_write_empty[2-True-False] _______________ 860s 860s self = 860s consolidated = False, write_empty = True 860s 860s @pytest.mark.parametrize("consolidated", [True, False, None]) 860s @pytest.mark.parametrize("write_empty", [True, False, None]) 860s def test_write_empty( 860s self, 860s consolidated: bool | None, 860s write_empty: bool | None, 860s ) -> None: 860s def assert_expected_files(expected: list[str], store: str) -> None: 860s """Convenience for comparing with actual files written""" 860s ls = [] 860s test_root = os.path.join(store, "test") 860s for root, _, files in os.walk(test_root): 860s ls.extend( 860s [ 860s os.path.join(root, f).removeprefix(test_root).lstrip("/") 860s for f in files 860s ] 860s ) 860s 860s assert set(expected) == set( 860s [ 860s file.lstrip("c/") 860s for file in ls 860s if (file not in (".zattrs", ".zarray", "zarr.json")) 860s ] 860s ) 860s 860s # The zarr format is set by the `default_zarr_format` 860s # pytest fixture that acts on a superclass 860s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 860s if (write_empty is False) or (write_empty is None and has_zarr_v3): 860s expected = ["0.1.0"] 860s else: 860s expected = [ 860s "0.0.0", 860s "0.0.1", 860s "0.1.0", 860s "0.1.1", 860s ] 860s 860s if zarr_format_3: 860s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 860s # transform to the path style of zarr 3 860s # e.g. 0/0/1 860s expected = [e.replace(".", "/") for e in expected] 860s else: 860s # use nan for default fill_value behaviour 860s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 860s 860s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 860s 860s if has_dask: 860s ds["test"] = ds["test"].chunk(1) 860s encoding = None 860s else: 860s encoding = {"test": {"chunks": (1, 1, 1)}} 860s 860s with self.temp_dir() as (d, store): 860s ds.to_zarr( 860s store, 860s mode="w", 860s encoding=encoding, 860s write_empty_chunks=write_empty, 860s ) 860s 860s # check expected files after a write 860s assert_expected_files(expected, store) 860s 860s with self.roundtrip_dir( 860s ds, 860s store, 860s save_kwargs={ 860s "mode": "a", 860s "append_dim": "Z", 860s "write_empty_chunks": write_empty, 860s }, 860s ) as a_ds: 860s expected_ds = xr.concat([ds, ds], dim="Z") 860s 860s assert_identical(a_ds, expected_ds.compute()) 860s # add the new files we expect to be created by the append 860s # that was performed by the roundtrip_dir 860s if (write_empty is False) or (write_empty is None and has_zarr_v3): 860s expected.append("1.1.0") 860s else: 860s if not has_zarr_v3: 860s # TODO: remove zarr3 if once zarr issue is fixed 860s # https://github.com/zarr-developers/zarr-python/issues/2931 860s expected.extend( 860s [ 860s "1.1.0", 860s "1.0.0", 860s "1.0.1", 860s "1.1.1", 860s ] 860s ) 860s else: 860s expected.append("1.1.0") 860s if zarr_format_3: 860s expected = [e.replace(".", "/") for e in expected] 860s > assert_expected_files(expected, store) 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 860s store = '/tmp/tmpki4c0h69/test.zarr' 860s 860s def assert_expected_files(expected: list[str], store: str) -> None: 860s """Convenience for comparing with actual files written""" 860s ls = [] 860s test_root = os.path.join(store, "test") 860s for root, _, files in os.walk(test_root): 860s ls.extend( 860s [ 860s os.path.join(root, f).removeprefix(test_root).lstrip("/") 860s for f in files 860s ] 860s ) 860s 860s > assert set(expected) == set( 860s [ 860s file.lstrip("c/") 860s for file in ls 860s if (file not in (".zattrs", ".zarray", "zarr.json")) 860s ] 860s ) 860s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 860s E 860s E Extra items in the right set: 860s E '1.0.0' 860s E '1.0.1' 860s E '1.1.1' 860s E Use -v to get more diff 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 860s _______________ TestZarrWriteEmpty.test_write_empty[2-True-None] _______________ 860s 860s self = 860s consolidated = None, write_empty = True 860s 860s @pytest.mark.parametrize("consolidated", [True, False, None]) 860s @pytest.mark.parametrize("write_empty", [True, False, None]) 860s def test_write_empty( 860s self, 860s consolidated: bool | None, 860s write_empty: bool | None, 860s ) -> None: 860s def assert_expected_files(expected: list[str], store: str) -> None: 860s """Convenience for comparing with actual files written""" 860s ls = [] 860s test_root = os.path.join(store, "test") 860s for root, _, files in os.walk(test_root): 860s ls.extend( 860s [ 860s os.path.join(root, f).removeprefix(test_root).lstrip("/") 860s for f in files 860s ] 860s ) 860s 860s assert set(expected) == set( 860s [ 860s file.lstrip("c/") 860s for file in ls 860s if (file not in (".zattrs", ".zarray", "zarr.json")) 860s ] 860s ) 860s 860s # The zarr format is set by the `default_zarr_format` 860s # pytest fixture that acts on a superclass 860s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 860s if (write_empty is False) or (write_empty is None and has_zarr_v3): 860s expected = ["0.1.0"] 860s else: 860s expected = [ 860s "0.0.0", 860s "0.0.1", 860s "0.1.0", 860s "0.1.1", 860s ] 860s 860s if zarr_format_3: 860s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 860s # transform to the path style of zarr 3 860s # e.g. 0/0/1 860s expected = [e.replace(".", "/") for e in expected] 860s else: 860s # use nan for default fill_value behaviour 860s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 860s 860s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 860s 860s if has_dask: 860s ds["test"] = ds["test"].chunk(1) 860s encoding = None 860s else: 860s encoding = {"test": {"chunks": (1, 1, 1)}} 860s 860s with self.temp_dir() as (d, store): 860s ds.to_zarr( 860s store, 860s mode="w", 860s encoding=encoding, 860s write_empty_chunks=write_empty, 860s ) 860s 860s # check expected files after a write 860s assert_expected_files(expected, store) 860s 860s with self.roundtrip_dir( 860s ds, 860s store, 860s save_kwargs={ 860s "mode": "a", 860s "append_dim": "Z", 860s "write_empty_chunks": write_empty, 860s }, 860s ) as a_ds: 860s expected_ds = xr.concat([ds, ds], dim="Z") 860s 860s assert_identical(a_ds, expected_ds.compute()) 860s # add the new files we expect to be created by the append 860s # that was performed by the roundtrip_dir 860s if (write_empty is False) or (write_empty is None and has_zarr_v3): 860s expected.append("1.1.0") 860s else: 860s if not has_zarr_v3: 860s # TODO: remove zarr3 if once zarr issue is fixed 860s # https://github.com/zarr-developers/zarr-python/issues/2931 860s expected.extend( 860s [ 860s "1.1.0", 860s "1.0.0", 860s "1.0.1", 860s "1.1.1", 860s ] 860s ) 860s else: 860s expected.append("1.1.0") 860s if zarr_format_3: 860s expected = [e.replace(".", "/") for e in expected] 860s > assert_expected_files(expected, store) 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 860s store = '/tmp/tmpaqwcvtql/test.zarr' 860s 860s def assert_expected_files(expected: list[str], store: str) -> None: 860s """Convenience for comparing with actual files written""" 860s ls = [] 860s test_root = os.path.join(store, "test") 860s for root, _, files in os.walk(test_root): 860s ls.extend( 860s [ 860s os.path.join(root, f).removeprefix(test_root).lstrip("/") 860s for f in files 860s ] 860s ) 860s 860s > assert set(expected) == set( 860s [ 860s file.lstrip("c/") 860s for file in ls 860s if (file not in (".zattrs", ".zarray", "zarr.json")) 860s ] 860s ) 860s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 860s E 860s E Extra items in the right set: 860s E '1.0.0' 860s E '1.0.1' 860s E '1.1.1' 860s E Use -v to get more diff 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 860s _____________ TestZarrDictStore.test_zero_dimensional_variable[3] ______________ 860s 860s self = 860s 860s def test_zero_dimensional_variable(self) -> None: 860s expected = create_test_data() 860s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 860s expected["bytes_var"] = ([], b"foobar") 860s expected["string_var"] = ([], "foobar") 860s > with self.roundtrip(expected) as actual: 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 860s with self.open(store_target, **open_kwargs) as ds: 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 860s with xr.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 860s ds = store_entrypoint.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 860s vars, attrs = filename_or_obj.load() 860s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 860s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 860s return Frozen(dict(*args, **kwargs)) 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = , name = 'dim2' 860s 860s def open_store_variable(self, name): 860s zarr_array = self.members[name] 860s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 860s try_nczarr = self._mode == "r" 860s dimensions, attributes = _get_zarr_dims_and_attrs( 860s zarr_array, DIMENSION_KEY, try_nczarr 860s ) 860s attributes = dict(attributes) 860s 860s encoding = { 860s "chunks": zarr_array.chunks, 860s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 860s } 860s 860s if _zarr_v3(): 860s encoding.update( 860s { 860s "compressors": zarr_array.compressors, 860s "filters": zarr_array.filters, 860s "shards": zarr_array.shards, 860s } 860s ) 860s if self.zarr_group.metadata.zarr_format == 3: 860s encoding.update({"serializer": zarr_array.serializer}) 860s else: 860s encoding.update( 860s { 860s "compressor": zarr_array.compressor, 860s "filters": zarr_array.filters, 860s } 860s ) 860s 860s if self._use_zarr_fill_value_as_mask: 860s # Setting this attribute triggers CF decoding for missing values 860s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 860s if zarr_array.fill_value is not None: 860s attributes["_FillValue"] = zarr_array.fill_value 860s elif "_FillValue" in attributes: 860s original_zarr_dtype = zarr_array.metadata.data_type 860s attributes["_FillValue"] = FillValueCoder.decode( 860s > attributes["_FillValue"], original_zarr_dtype.value 860s ) 860s E AttributeError: 'Float64' object has no attribute 'value' 860s 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 860s ____________________ TestZarrDictStore.test_write_store[3] _____________________ 860s 860s self = 860s 860s def test_write_store(self) -> None: 860s expected = create_test_data() 860s with self.create_store() as store: 860s expected.dump_to_store(store) 860s # we need to cf decode the store because it has time and 860s # non-dimension coordinates 860s > with xr.decode_cf(store) as actual: 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 860s vars, attrs = obj.load() 860s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 860s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 860s return Frozen(dict(*args, **kwargs)) 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = , name = 'var2' 860s 860s def open_store_variable(self, name): 860s zarr_array = self.members[name] 860s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 860s try_nczarr = self._mode == "r" 860s dimensions, attributes = _get_zarr_dims_and_attrs( 860s zarr_array, DIMENSION_KEY, try_nczarr 860s ) 860s attributes = dict(attributes) 860s 860s encoding = { 860s "chunks": zarr_array.chunks, 860s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 860s } 860s 860s if _zarr_v3(): 860s encoding.update( 860s { 860s "compressors": zarr_array.compressors, 860s "filters": zarr_array.filters, 860s "shards": zarr_array.shards, 860s } 860s ) 860s if self.zarr_group.metadata.zarr_format == 3: 860s encoding.update({"serializer": zarr_array.serializer}) 860s else: 860s encoding.update( 860s { 860s "compressor": zarr_array.compressor, 860s "filters": zarr_array.filters, 860s } 860s ) 860s 860s if self._use_zarr_fill_value_as_mask: 860s # Setting this attribute triggers CF decoding for missing values 860s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 860s if zarr_array.fill_value is not None: 860s attributes["_FillValue"] = zarr_array.fill_value 860s elif "_FillValue" in attributes: 860s original_zarr_dtype = zarr_array.metadata.data_type 860s attributes["_FillValue"] = FillValueCoder.decode( 860s > attributes["_FillValue"], original_zarr_dtype.value 860s ) 860s E AttributeError: 'Float64' object has no attribute 'value' 860s 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 860s ________________ TestZarrDictStore.test_roundtrip_test_data[3] _________________ 860s 860s self = 860s 860s def test_roundtrip_test_data(self) -> None: 860s expected = create_test_data() 860s > with self.roundtrip(expected) as actual: 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 860s with self.open(store_target, **open_kwargs) as ds: 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 860s with xr.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 860s ds = store_entrypoint.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 860s vars, attrs = filename_or_obj.load() 860s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 860s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 860s return Frozen(dict(*args, **kwargs)) 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = , name = 'dim2' 860s 860s def open_store_variable(self, name): 860s zarr_array = self.members[name] 860s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 860s try_nczarr = self._mode == "r" 860s dimensions, attributes = _get_zarr_dims_and_attrs( 860s zarr_array, DIMENSION_KEY, try_nczarr 860s ) 860s attributes = dict(attributes) 860s 860s encoding = { 860s "chunks": zarr_array.chunks, 860s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 860s } 860s 860s if _zarr_v3(): 860s encoding.update( 860s { 860s "compressors": zarr_array.compressors, 860s "filters": zarr_array.filters, 860s "shards": zarr_array.shards, 860s } 860s ) 860s if self.zarr_group.metadata.zarr_format == 3: 860s encoding.update({"serializer": zarr_array.serializer}) 860s else: 860s encoding.update( 860s { 860s "compressor": zarr_array.compressor, 860s "filters": zarr_array.filters, 860s } 860s ) 860s 860s if self._use_zarr_fill_value_as_mask: 860s # Setting this attribute triggers CF decoding for missing values 860s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 860s if zarr_array.fill_value is not None: 860s attributes["_FillValue"] = zarr_array.fill_value 860s elif "_FillValue" in attributes: 860s original_zarr_dtype = zarr_array.metadata.data_type 860s attributes["_FillValue"] = FillValueCoder.decode( 860s > attributes["_FillValue"], original_zarr_dtype.value 860s ) 860s E AttributeError: 'Float64' object has no attribute 'value' 860s 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 860s ________________________ TestZarrDictStore.test_load[3] ________________________ 860s 860s self = 860s 860s def test_load(self) -> None: 860s expected = create_test_data() 860s 860s @contextlib.contextmanager 860s def assert_loads(vars=None): 860s if vars is None: 860s vars = expected 860s with self.roundtrip(expected) as actual: 860s for k, v in actual.variables.items(): 860s # IndexVariables are eagerly loaded into memory 860s assert v._in_memory == (k in actual.dims) 860s yield actual 860s for k, v in actual.variables.items(): 860s if k in vars: 860s assert v._in_memory 860s assert_identical(expected, actual) 860s 860s with pytest.raises(AssertionError): 860s # make sure the contextmanager works! 860s > with assert_loads() as ds: 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 860s with self.roundtrip(expected) as actual: 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 860s with self.open(store_target, **open_kwargs) as ds: 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 860s with xr.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 860s ds = store_entrypoint.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 860s vars, attrs = filename_or_obj.load() 860s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 860s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 860s return Frozen(dict(*args, **kwargs)) 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = , name = 'dim2' 860s 860s def open_store_variable(self, name): 860s zarr_array = self.members[name] 860s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 860s try_nczarr = self._mode == "r" 860s dimensions, attributes = _get_zarr_dims_and_attrs( 860s zarr_array, DIMENSION_KEY, try_nczarr 860s ) 860s attributes = dict(attributes) 860s 860s encoding = { 860s "chunks": zarr_array.chunks, 860s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 860s } 860s 860s if _zarr_v3(): 860s encoding.update( 860s { 860s "compressors": zarr_array.compressors, 860s "filters": zarr_array.filters, 860s "shards": zarr_array.shards, 860s } 860s ) 860s if self.zarr_group.metadata.zarr_format == 3: 860s encoding.update({"serializer": zarr_array.serializer}) 860s else: 860s encoding.update( 860s { 860s "compressor": zarr_array.compressor, 860s "filters": zarr_array.filters, 860s } 860s ) 860s 860s if self._use_zarr_fill_value_as_mask: 860s # Setting this attribute triggers CF decoding for missing values 860s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 860s if zarr_array.fill_value is not None: 860s attributes["_FillValue"] = zarr_array.fill_value 860s elif "_FillValue" in attributes: 860s original_zarr_dtype = zarr_array.metadata.data_type 860s attributes["_FillValue"] = FillValueCoder.decode( 860s > attributes["_FillValue"], original_zarr_dtype.value 860s ) 860s E AttributeError: 'Float64' object has no attribute 'value' 860s 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 860s __________________ TestZarrDictStore.test_dataset_compute[3] ___________________ 860s 860s self = 860s 860s def test_dataset_compute(self) -> None: 860s expected = create_test_data() 860s 860s > with self.roundtrip(expected) as actual: 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 860s with self.open(store_target, **open_kwargs) as ds: 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 860s with xr.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 860s ds = store_entrypoint.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 860s vars, attrs = filename_or_obj.load() 860s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 860s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 860s return Frozen(dict(*args, **kwargs)) 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = , name = 'dim2' 860s 860s def open_store_variable(self, name): 860s zarr_array = self.members[name] 860s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 860s try_nczarr = self._mode == "r" 860s dimensions, attributes = _get_zarr_dims_and_attrs( 860s zarr_array, DIMENSION_KEY, try_nczarr 860s ) 860s attributes = dict(attributes) 860s 860s encoding = { 860s "chunks": zarr_array.chunks, 860s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 860s } 860s 860s if _zarr_v3(): 860s encoding.update( 860s { 860s "compressors": zarr_array.compressors, 860s "filters": zarr_array.filters, 860s "shards": zarr_array.shards, 860s } 860s ) 860s if self.zarr_group.metadata.zarr_format == 3: 860s encoding.update({"serializer": zarr_array.serializer}) 860s else: 860s encoding.update( 860s { 860s "compressor": zarr_array.compressor, 860s "filters": zarr_array.filters, 860s } 860s ) 860s 860s if self._use_zarr_fill_value_as_mask: 860s # Setting this attribute triggers CF decoding for missing values 860s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 860s if zarr_array.fill_value is not None: 860s attributes["_FillValue"] = zarr_array.fill_value 860s elif "_FillValue" in attributes: 860s original_zarr_dtype = zarr_array.metadata.data_type 860s attributes["_FillValue"] = FillValueCoder.decode( 860s > attributes["_FillValue"], original_zarr_dtype.value 860s ) 860s E AttributeError: 'Float64' object has no attribute 'value' 860s 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 860s _______________ TestZarrDictStore.test_roundtrip_object_dtype[3] _______________ 860s 860s self = 860s 860s def test_roundtrip_object_dtype(self) -> None: 860s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 860s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 860s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 860s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 860s strings = np.array(["ab", "cdef", "g"], dtype=object) 860s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 860s all_nans = np.array([np.nan, np.nan], dtype=object) 860s original = Dataset( 860s { 860s "floats": ("a", floats), 860s "floats_nans": ("a", floats_nans), 860s "bytes": ("b", bytes_), 860s "bytes_nans": ("b", bytes_nans), 860s "strings": ("b", strings), 860s "strings_nans": ("b", strings_nans), 860s "all_nans": ("c", all_nans), 860s "nan": ([], np.nan), 860s } 860s ) 860s expected = original.copy(deep=True) 860s > with self.roundtrip(original) as actual: 860s 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 860s with self.open(store_target, **open_kwargs) as ds: 860s /usr/lib/python3.14/contextlib.py:141: in __enter__ 860s return next(self.gen) 860s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 860s with xr.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 860s backend_ds = backend.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 860s ds = store_entrypoint.open_dataset( 860s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 860s vars, attrs = filename_or_obj.load() 860s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 860s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 860s return Frozen(dict(*args, **kwargs)) 860s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 860s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 860s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 860s 860s self = , name = 'nan' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______________ TestZarrDictStore.test_roundtrip_float64_data[3] _______________ 861s 861s self = 861s 861s def test_roundtrip_float64_data(self) -> None: 861s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 861s > with self.roundtrip(expected) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_orthogonal_indexing[3] _________________ 861s 861s self = 861s 861s def test_orthogonal_indexing(self) -> None: 861s in_memory = create_test_data() 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_vectorized_indexing[3] _________________ 861s 861s self = 861s 861s def test_vectorized_indexing(self) -> None: 861s in_memory = create_test_data() 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_vectorized_indexing_negative_step[3] __________ 861s 861s self = 861s 861s def test_vectorized_indexing_negative_step(self) -> None: 861s # use dask explicitly when present 861s open_kwargs: dict[str, Any] | None 861s if has_dask: 861s open_kwargs = {"chunks": {}} 861s else: 861s open_kwargs = None 861s in_memory = create_test_data() 861s 861s def multiple_indexing(indexers): 861s # make sure a sequence of lazy indexings certainly works. 861s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 861s actual = on_disk["var3"] 861s expected = in_memory["var3"] 861s for ind in indexers: 861s actual = actual.isel(ind) 861s expected = expected.isel(ind) 861s # make sure the array is not yet loaded into memory 861s assert not actual.variable._in_memory 861s assert_identical(expected, actual.load()) 861s 861s # with negative step slice. 861s indexers = [ 861s { 861s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 861s "dim3": slice(-1, 1, -1), 861s } 861s ] 861s > multiple_indexing(indexers) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 861s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDictStore.test_outer_indexing_reversed[3] _______________ 861s 861s self = 861s 861s def test_outer_indexing_reversed(self) -> None: 861s # regression test for GH6560 861s ds = xr.Dataset( 861s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 861s ) 861s 861s > with self.roundtrip(ds) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'z' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________________ TestZarrDictStore.test_isel_dataarray[3] ___________________ 861s 861s self = 861s 861s def test_isel_dataarray(self) -> None: 861s # Make sure isel works lazily. GH:issue:1688 861s in_memory = create_test_data() 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _____________ TestZarrDictStore.test_array_type_after_indexing[3] ______________ 861s 861s self = 861s 861s def test_array_type_after_indexing(self) -> None: 861s in_memory = create_test_data() 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______________________ TestZarrDictStore.test_dropna[3] _______________________ 861s 861s self = 861s 861s def test_dropna(self) -> None: 861s # regression test for GH:issue:1694 861s a = np.random.randn(4, 3) 861s a[1, 1] = np.nan 861s in_memory = xr.Dataset( 861s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 861s ) 861s 861s assert_identical( 861s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 861s ) 861s 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'a' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________________ TestZarrDictStore.test_ondisk_after_print[3] _________________ 861s 861s self = 861s 861s def test_ondisk_after_print(self) -> None: 861s """Make sure print does not load file into memory""" 861s in_memory = create_test_data() 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________ TestZarrDictStore.test_roundtrip_bytes_with_fill_value[3] ___________ 861s 861s self = 861s 861s def test_roundtrip_bytes_with_fill_value(self) -> None: 861s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 861s encoding = {"_FillValue": b"X", "dtype": "S1"} 861s original = Dataset({"x": ("t", values, {}, encoding)}) 861s expected = original.copy(deep=True) 861s > with self.roundtrip(original) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value0-False] ________ 861s 861s self = 861s fill_value = np.int8(-1), exp_fill_warning = False 861s 861s @pytest.mark.parametrize( 861s ("fill_value", "exp_fill_warning"), 861s [ 861s (np.int8(-1), False), 861s (np.uint8(255), True), 861s (-1, False), 861s (255, True), 861s ], 861s ) 861s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 861s @contextlib.contextmanager 861s def _roundtrip_with_warnings(*args, **kwargs): 861s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 861s if exp_fill_warning and is_np2: 861s warn_checker: contextlib.AbstractContextManager = pytest.warns( 861s SerializationWarning, 861s match="_FillValue attribute can't be represented", 861s ) 861s else: 861s warn_checker = contextlib.nullcontext() 861s with warn_checker: 861s with self.roundtrip(*args, **kwargs) as actual: 861s yield actual 861s 861s # regression/numpy2 test for 861s encoding = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s "dtype": "i1", 861s } 861s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 861s decoded = Dataset({"x": ("t", x, {}, encoding)}) 861s 861s attributes = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s } 861s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 861s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 861s encoded = Dataset({"x": ("t", sb, attributes)}) 861s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 861s 861s > with _roundtrip_with_warnings(decoded) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 861s with self.roundtrip(*args, **kwargs) as actual: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Int8' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value1-True] _________ 861s 861s self = 861s fill_value = np.uint8(255), exp_fill_warning = True 861s 861s @pytest.mark.parametrize( 861s ("fill_value", "exp_fill_warning"), 861s [ 861s (np.int8(-1), False), 861s (np.uint8(255), True), 861s (-1, False), 861s (255, True), 861s ], 861s ) 861s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 861s @contextlib.contextmanager 861s def _roundtrip_with_warnings(*args, **kwargs): 861s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 861s if exp_fill_warning and is_np2: 861s warn_checker: contextlib.AbstractContextManager = pytest.warns( 861s SerializationWarning, 861s match="_FillValue attribute can't be represented", 861s ) 861s else: 861s warn_checker = contextlib.nullcontext() 861s with warn_checker: 861s with self.roundtrip(*args, **kwargs) as actual: 861s yield actual 861s 861s # regression/numpy2 test for 861s encoding = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s "dtype": "i1", 861s } 861s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 861s decoded = Dataset({"x": ("t", x, {}, encoding)}) 861s 861s attributes = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s } 861s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 861s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 861s encoded = Dataset({"x": ("t", sb, attributes)}) 861s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 861s 861s > with _roundtrip_with_warnings(decoded) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 861s with self.roundtrip(*args, **kwargs) as actual: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Int8' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDictStore.test_roundtrip_unsigned[3--1-False] _____________ 861s 861s self = 861s fill_value = -1, exp_fill_warning = False 861s 861s @pytest.mark.parametrize( 861s ("fill_value", "exp_fill_warning"), 861s [ 861s (np.int8(-1), False), 861s (np.uint8(255), True), 861s (-1, False), 861s (255, True), 861s ], 861s ) 861s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 861s @contextlib.contextmanager 861s def _roundtrip_with_warnings(*args, **kwargs): 861s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 861s if exp_fill_warning and is_np2: 861s warn_checker: contextlib.AbstractContextManager = pytest.warns( 861s SerializationWarning, 861s match="_FillValue attribute can't be represented", 861s ) 861s else: 861s warn_checker = contextlib.nullcontext() 861s with warn_checker: 861s with self.roundtrip(*args, **kwargs) as actual: 861s yield actual 861s 861s # regression/numpy2 test for 861s encoding = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s "dtype": "i1", 861s } 861s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 861s decoded = Dataset({"x": ("t", x, {}, encoding)}) 861s 861s attributes = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s } 861s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 861s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 861s encoded = Dataset({"x": ("t", sb, attributes)}) 861s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 861s 861s > with _roundtrip_with_warnings(decoded) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 861s with self.roundtrip(*args, **kwargs) as actual: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Int8' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDictStore.test_roundtrip_unsigned[3-255-True] _____________ 861s 861s self = 861s fill_value = 255, exp_fill_warning = True 861s 861s @pytest.mark.parametrize( 861s ("fill_value", "exp_fill_warning"), 861s [ 861s (np.int8(-1), False), 861s (np.uint8(255), True), 861s (-1, False), 861s (255, True), 861s ], 861s ) 861s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 861s @contextlib.contextmanager 861s def _roundtrip_with_warnings(*args, **kwargs): 861s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 861s if exp_fill_warning and is_np2: 861s warn_checker: contextlib.AbstractContextManager = pytest.warns( 861s SerializationWarning, 861s match="_FillValue attribute can't be represented", 861s ) 861s else: 861s warn_checker = contextlib.nullcontext() 861s with warn_checker: 861s with self.roundtrip(*args, **kwargs) as actual: 861s yield actual 861s 861s # regression/numpy2 test for 861s encoding = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s "dtype": "i1", 861s } 861s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 861s decoded = Dataset({"x": ("t", x, {}, encoding)}) 861s 861s attributes = { 861s "_FillValue": fill_value, 861s "_Unsigned": "true", 861s } 861s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 861s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 861s encoded = Dataset({"x": ("t", sb, attributes)}) 861s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 861s 861s > with _roundtrip_with_warnings(decoded) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 861s with self.roundtrip(*args, **kwargs) as actual: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Int8' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 861s 861s self = 861s 861s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 861s original = self._create_cf_dataset() 861s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = 861s name = 'det_lim' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____ TestZarrDictStore.test_coordinate_variables_after_dataset_roundtrip[3] ____ 861s 861s self = 861s 861s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 861s original = self._create_cf_dataset() 861s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = 861s name = 'det_lim' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 861s 861s self = 861s 861s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 861s self, 861s ) -> None: 861s original = self._create_cf_dataset() 861s # The DataArray roundtrip should have the same warnings as the 861s # Dataset, but we already tested for those, so just go for the 861s # new warnings. It would appear that there is no way to tell 861s # pytest "This warning and also this warning should both be 861s # present". 861s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 861s # needs the to_dataset. The other backends should be fine 861s # without it. 861s with pytest.warns( 861s UserWarning, 861s match=( 861s r"Variable\(s\) referenced in bounds not in variables: " 861s r"\['l(at|ong)itude_bnds'\]" 861s ), 861s ): 861s > with self.roundtrip( 861s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'ln_p' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s 861s During handling of the above exception, another exception occurred: 861s 861s self = 861s 861s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 861s self, 861s ) -> None: 861s original = self._create_cf_dataset() 861s # The DataArray roundtrip should have the same warnings as the 861s # Dataset, but we already tested for those, so just go for the 861s # new warnings. It would appear that there is no way to tell 861s # pytest "This warning and also this warning should both be 861s # present". 861s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 861s # needs the to_dataset. The other backends should be fine 861s # without it. 861s > with pytest.warns( 861s UserWarning, 861s match=( 861s r"Variable\(s\) referenced in bounds not in variables: " 861s r"\['l(at|ong)itude_bnds'\]" 861s ), 861s ): 861s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 861s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 861s 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.')]. 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 861s ___________________ TestZarrDictStore.test_encoding_kwarg[3] ___________________ 861s 861s self = 861s 861s def test_encoding_kwarg(self) -> None: 861s ds = Dataset({"x": ("y", np.arange(10.0))}) 861s 861s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 861s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float32' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________________ TestZarrDictStore.test_default_fill_value[3] _________________ 861s 861s self = 861s 861s def test_default_fill_value(self) -> None: 861s # Test default encoding for float: 861s ds = Dataset({"x": ("y", np.arange(10.0))}) 861s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 861s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float32' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord[3] _________ 861s 861s self = 861s 861s def test_explicitly_omit_fill_value_in_coord(self) -> None: 861s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 861s ds.y.encoding["_FillValue"] = None 861s > with self.roundtrip(ds) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 861s 861s self = 861s 861s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 861s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 861s kwargs = dict(encoding={"y": {"_FillValue": None}}) 861s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_encoding_same_dtype[3] _________________ 861s 861s self = 861s 861s def test_encoding_same_dtype(self) -> None: 861s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 861s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 861s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float32' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDictStore.test_append_overwrite_values[3] _______________ 861s 861s self = 861s 861s def test_append_overwrite_values(self) -> None: 861s # regression for GH1215 861s data = create_test_data() 861s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 861s self.save(data, tmp_file, mode="w") 861s data["var2"][:] = -999 861s data["var9"] = data["var2"] * 3 861s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 861s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'var2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-False] ____________ 861s 861s self = 861s consolidated = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s def test_roundtrip_consolidated(self, consolidated) -> None: 861s expected = create_test_data() 861s > with self.roundtrip( 861s expected, 861s save_kwargs={"consolidated": consolidated}, 861s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'var2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-True] _____________ 861s 861s self = 861s consolidated = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s def test_roundtrip_consolidated(self, consolidated) -> None: 861s expected = create_test_data() 861s > with self.roundtrip( 861s expected, 861s save_kwargs={"consolidated": consolidated}, 861s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-None] _____________ 861s 861s self = 861s consolidated = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s def test_roundtrip_consolidated(self, consolidated) -> None: 861s expected = create_test_data() 861s > with self.roundtrip( 861s expected, 861s save_kwargs={"consolidated": consolidated}, 861s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________ TestZarrDictStore.test_read_non_consolidated_warning[3] ____________ 861s 861s self = 861s 861s def test_read_non_consolidated_warning(self) -> None: 861s expected = create_test_data() 861s with self.create_zarr_target() as store: 861s self.save( 861s expected, store_target=store, consolidated=False, **self.version_kwargs 861s ) 861s with pytest.warns( 861s RuntimeWarning, 861s match="Failed to open Zarr store with consolidated", 861s ): 861s > with xr.open_zarr(store, **self.version_kwargs) as ds: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'var2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________________ TestZarrDictStore.test_non_existent_store[3] _________________ 861s 861s self = 861s 861s def test_non_existent_store(self) -> None: 861s with pytest.raises( 861s FileNotFoundError, match="(No such file or directory|Unable to find group)" 861s ): 861s > xr.open_zarr(f"{uuid.uuid4()}") 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 861s store = ZarrStore.open_group( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 861s ) = _get_open_params( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 861s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 861s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 861s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 861s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 861s raise return_result 861s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 861s return await coro 861s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 861s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 861s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 861s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 861s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 861s store = await make_store(store_like, mode=mode, storage_options=storage_options) 861s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 861s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 861s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 861s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 861s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 861s await store._open() 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/17602d32-0a3a-4a4c-bb08-c083fe564ac4') 861s 861s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 861s if not self.read_only: 861s self.root.mkdir(parents=True, exist_ok=True) 861s 861s if not self.root.exists(): 861s > raise FileNotFoundError(f"{self.root} does not exist") 861s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/17602d32-0a3a-4a4c-bb08-c083fe564ac4 does not exist 861s 861s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 861s 861s During handling of the above exception, another exception occurred: 861s 861s self = 861s 861s def test_non_existent_store(self) -> None: 861s > with pytest.raises( 861s FileNotFoundError, match="(No such file or directory|Unable to find group)" 861s ): 861s E AssertionError: Regex pattern did not match. 861s E Regex: '(No such file or directory|Unable to find group)' 861s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/17602d32-0a3a-4a4c-bb08-c083fe564ac4 does not exist' 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 861s _____________________ TestZarrDictStore.test_auto_chunk[3] _____________________ 861s 861s self = 861s 861s @requires_dask 861s def test_auto_chunk(self) -> None: 861s original = create_test_data().chunk() 861s 861s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________________ TestZarrDictStore.test_manual_chunk[3] ____________________ 861s 861s self = 861s 861s @requires_dask 861s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 861s def test_manual_chunk(self) -> None: 861s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 861s 861s # Using chunks = None should return non-chunked arrays 861s open_kwargs: dict[str, Any] = {"chunks": None} 861s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______________ TestZarrDictStore.test_warning_on_bad_chunks[3] ________________ 861s 861s self = 861s 861s @requires_dask 861s def test_warning_on_bad_chunks(self) -> None: 861s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 861s 861s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 861s for chunks in bad_chunks: 861s kwargs = {"chunks": chunks} 861s with pytest.warns(UserWarning): 861s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDictStore.test_write_uneven_dask_chunks[3] ______________ 861s 861s self = 861s 861s @requires_dask 861s def test_write_uneven_dask_chunks(self) -> None: 861s # regression for GH#2225 861s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 861s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________________ TestZarrDictStore.test_chunk_encoding[3] ___________________ 861s 861s self = 861s 861s def test_chunk_encoding(self) -> None: 861s # These datasets have no dask chunks. All chunking specified in 861s # encoding 861s data = create_test_data() 861s chunks = (5, 5) 861s data["var2"].encoding.update({"chunks": chunks}) 861s 861s > with self.roundtrip(data) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________________ TestZarrDictStore.test_shard_encoding[3] ___________________ 861s 861s self = 861s 861s def test_shard_encoding(self) -> None: 861s # These datasets have no dask chunks. All chunking/sharding specified in 861s # encoding 861s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 861s data = create_test_data() 861s chunks = (1, 1) 861s shards = (5, 5) 861s data["var2"].encoding.update({"chunks": chunks}) 861s data["var2"].encoding.update({"shards": shards}) 861s > with self.roundtrip(data) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDictStore.test_write_persistence_modes[3-None] ____________ 861s 861s self = 861s group = None 861s 861s @pytest.mark.parametrize("group", [None, "group1"]) 861s def test_write_persistence_modes(self, group) -> None: 861s original = create_test_data() 861s 861s # overwrite mode 861s > with self.roundtrip( 861s original, 861s save_kwargs={"mode": "w", "group": group}, 861s open_kwargs={"group": group}, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________ TestZarrDictStore.test_write_persistence_modes[3-group1] ___________ 861s 861s self = 861s group = 'group1' 861s 861s @pytest.mark.parametrize("group", [None, "group1"]) 861s def test_write_persistence_modes(self, group) -> None: 861s original = create_test_data() 861s 861s # overwrite mode 861s > with self.roundtrip( 861s original, 861s save_kwargs={"mode": "w", "group": group}, 861s open_kwargs={"group": group}, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_compressor_encoding[3] _________________ 861s 861s self = 861s 861s def test_compressor_encoding(self) -> None: 861s # specify a custom compressor 861s original = create_test_data() 861s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 861s encoding_key = "compressors" 861s # all parameters need to be explicitly specified in order for the comparison to pass below 861s encoding = { 861s "serializer": zarr.codecs.BytesCodec(endian="little"), 861s encoding_key: ( 861s zarr.codecs.BloscCodec( 861s cname="zstd", 861s clevel=3, 861s shuffle="shuffle", 861s typesize=8, 861s blocksize=0, 861s ), 861s ), 861s } 861s else: 861s from numcodecs.blosc import Blosc 861s 861s encoding_key = "compressors" if has_zarr_v3 else "compressor" 861s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 861s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 861s 861s save_kwargs = dict(encoding={"var1": encoding}) 861s 861s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______________________ TestZarrDictStore.test_group[3] ________________________ 861s 861s self = 861s 861s def test_group(self) -> None: 861s original = create_test_data() 861s group = "some/random/path" 861s > with self.roundtrip( 861s original, save_kwargs={"group": group}, open_kwargs={"group": group} 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________________ TestZarrDictStore.test_append_write[3] ____________________ 861s 861s self = 861s 861s def test_append_write(self) -> None: 861s > super().test_append_write() 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 861s with self.roundtrip_append(data) as actual: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 861s self.save(data[[key]], path, mode=mode, **save_kwargs) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 861s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______ TestZarrDictStore.test_append_with_append_dim_not_set_raises[3] ________ 861s 861s self = 861s 861s def test_append_with_append_dim_not_set_raises(self) -> None: 861s ds, ds_to_append, _ = create_append_test_data() 861s with self.create_zarr_target() as store_target: 861s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 861s with pytest.raises(ValueError, match="different dimension sizes"): 861s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'da' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-U] ________ 861s 861s self = 861s dtype = 'U' 861s 861s @pytest.mark.parametrize("dtype", ["U", "S"]) 861s def test_append_string_length_mismatch_works(self, dtype) -> None: 861s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 861s # ...but it probably would if we used object dtype 861s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 861s expected = xr.concat([ds, ds_to_append], dim="time") 861s with self.create_zarr_target() as store_target: 861s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 861s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 861s _validate_datatypes_for_zarr_append( 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s vname = 'temperature' 861s existing_var = Size: 96B 861s [3 values with dtype=>U8] 861s new_var = Size: 60B 861s array(['abc', 'def', 'ghijk'], dtype='>U5') 861s 861s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 861s """If variable exists in the store, confirm dtype of the data to append is compatible with 861s existing dtype. 861s """ 861s if ( 861s np.issubdtype(new_var.dtype, np.number) 861s or np.issubdtype(new_var.dtype, np.datetime64) 861s or np.issubdtype(new_var.dtype, np.bool_) 861s or new_var.dtype == object 861s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 861s ): 861s # We can skip dtype equality checks under two conditions: (1) if the var to append is 861s # new to the dataset, because in this case there is no existing var to compare it to; 861s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 861s # we can be confident appending won't cause problems. Examples of dtypes which are not 861s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 861s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 861s f"and dataset to append. Store has dtype {existing_var.dtype} but " 861s f"dataset to append has dtype {new_var.dtype}." 861s ) 861s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype >U8 but dataset to append has dtype >U5. 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 861s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-S] ________ 861s 861s self = 861s dtype = 'S' 861s 861s @pytest.mark.parametrize("dtype", ["U", "S"]) 861s def test_append_string_length_mismatch_works(self, dtype) -> None: 861s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 861s # ...but it probably would if we used object dtype 861s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 861s expected = xr.concat([ds, ds_to_append], dim="time") 861s with self.create_zarr_target() as store_target: 861s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 861s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 861s _validate_datatypes_for_zarr_append( 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s vname = 'temperature' 861s existing_var = Size: 6B 861s [3 values with dtype=|S2] 861s new_var = Size: 9B 861s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 861s 861s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 861s """If variable exists in the store, confirm dtype of the data to append is compatible with 861s existing dtype. 861s """ 861s if ( 861s np.issubdtype(new_var.dtype, np.number) 861s or np.issubdtype(new_var.dtype, np.datetime64) 861s or np.issubdtype(new_var.dtype, np.bool_) 861s or new_var.dtype == object 861s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 861s ): 861s # We can skip dtype equality checks under two conditions: (1) if the var to append is 861s # new to the dataset, because in this case there is no existing var to compare it to; 861s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 861s # we can be confident appending won't cause problems. Examples of dtypes which are not 861s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 861s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 861s f"and dataset to append. Store has dtype {existing_var.dtype} but " 861s f"dataset to append has dtype {new_var.dtype}." 861s ) 861s 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. 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 861s _____ TestZarrDictStore.test_check_encoding_is_consistent_after_append[3] ______ 861s 861s self = 861s 861s def test_check_encoding_is_consistent_after_append(self) -> None: 861s ds, ds_to_append, _ = create_append_test_data() 861s 861s # check encoding consistency 861s with self.create_zarr_target() as store_target: 861s import numcodecs 861s 861s encoding_value: Any 861s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 861s compressor = zarr.codecs.BloscCodec() 861s else: 861s compressor = numcodecs.Blosc() 861s encoding_key = "compressors" if has_zarr_v3 else "compressor" 861s encoding_value = (compressor,) if has_zarr_v3 else compressor 861s 861s encoding = {"da": {encoding_key: encoding_value}} 861s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 861s > original_ds = xr.open_dataset( 861s store_target, engine="zarr", **self.version_kwargs 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'da' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDictStore.test_append_with_new_variable[3] ______________ 861s 861s self = 861s 861s def test_append_with_new_variable(self) -> None: 861s ds, ds_to_append, ds_with_new_var = create_append_test_data() 861s 861s # check append mode for new variable 861s with self.create_zarr_target() as store_target: 861s combined = xr.concat([ds, ds_to_append], dim="time") 861s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 861s assert_identical( 861s combined, 861s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'da' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_append_with_append_dim_no_overwrite[3] _________ 861s 861s self = 861s 861s def test_append_with_append_dim_no_overwrite(self) -> None: 861s ds, ds_to_append, _ = create_append_test_data() 861s with self.create_zarr_target() as store_target: 861s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 861s original = xr.concat([ds, ds_to_append], dim="time") 861s original2 = xr.concat([original, ds_to_append], dim="time") 861s 861s # overwrite a coordinate; 861s # for mode='a-', this will not get written to the store 861s # because it does not have the append_dim as a dim 861s lon = ds_to_append.lon.to_numpy().copy() 861s lon[:] = -999 861s ds_to_append["lon"] = lon 861s > ds_to_append.to_zarr( 861s store_target, mode="a-", append_dim="time", **self.version_kwargs 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'da' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________ TestZarrDictStore.test_to_zarr_compute_false_roundtrip[3] ___________ 861s 861s self = 861s 861s @requires_dask 861s def test_to_zarr_compute_false_roundtrip(self) -> None: 861s from dask.delayed import Delayed 861s 861s original = create_test_data().chunk() 861s 861s with self.create_zarr_target() as store: 861s delayed_obj = self.save(original, store, compute=False) 861s assert isinstance(delayed_obj, Delayed) 861s 861s # make sure target store has not been written to yet 861s with pytest.raises(AssertionError): 861s > with self.open(store) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______ TestZarrDictStore.test_to_zarr_append_compute_false_roundtrip[3] _______ 861s 861s self = 861s 861s @requires_dask 861s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 861s from dask.delayed import Delayed 861s 861s ds, ds_to_append, _ = create_append_test_data() 861s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 861s 861s with pytest.warns(SerializationWarning): 861s with self.create_zarr_target() as store: 861s delayed_obj = self.save(ds, store, compute=False, mode="w") 861s assert isinstance(delayed_obj, Delayed) 861s 861s with pytest.raises(AssertionError): 861s > with self.open(store) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'da' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_save_emptydim[3-False] _________________ 861s 861s self = 861s chunk = False 861s 861s @pytest.mark.parametrize("chunk", [False, True]) 861s def test_save_emptydim(self, chunk) -> None: 861s if chunk and not has_dask: 861s pytest.skip("requires dask") 861s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 861s if chunk: 861s ds = ds.chunk({}) # chunk dataset to save dask array 861s > with self.roundtrip(ds) as ds_reload: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________________ TestZarrDictStore.test_save_emptydim[3-True] _________________ 861s 861s self = 861s chunk = True 861s 861s @pytest.mark.parametrize("chunk", [False, True]) 861s def test_save_emptydim(self, chunk) -> None: 861s if chunk and not has_dask: 861s pytest.skip("requires dask") 861s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 861s if chunk: 861s ds = ds.chunk({}) # chunk dataset to save dask array 861s > with self.roundtrip(ds) as ds_reload: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _____ TestZarrDictStore.test_no_warning_from_open_emptydim_with_chunks[3] ______ 861s 861s self = 861s 861s @requires_dask 861s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 861s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 861s with assert_no_warnings(): 861s with warnings.catch_warnings(): 861s warnings.filterwarnings( 861s "ignore", 861s message=".*Zarr format 3 specification.*", 861s category=UserWarning, 861s ) 861s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-False-False-False-False] ________ 861s 861s self = 861s consolidated = False, compute = False, use_dask = False, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-False-False-False-True] _________ 861s 861s self = 861s consolidated = True, compute = False, use_dask = False, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-False-False-False-None] _________ 861s 861s self = 861s consolidated = None, compute = False, use_dask = False, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-False-False-True-False] _________ 861s 861s self = 861s consolidated = False, compute = True, use_dask = False, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-False-True-True] _________ 861s 861s self = 861s consolidated = True, compute = True, use_dask = False, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-False-True-None] _________ 861s 861s self = 861s consolidated = None, compute = True, use_dask = False, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-False-True-False-False] _________ 861s 861s self = 861s consolidated = False, compute = False, use_dask = True, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-True-False-True] _________ 861s 861s self = 861s consolidated = True, compute = False, use_dask = True, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-True-False-None] _________ 861s 861s self = 861s consolidated = None, compute = False, use_dask = True, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-True-True-False] _________ 861s 861s self = 861s consolidated = False, compute = True, use_dask = True, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-True-True-True] __________ 861s 861s self = 861s consolidated = True, compute = True, use_dask = True, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-False-True-True-None] __________ 861s 861s self = 861s consolidated = None, compute = True, use_dask = True, write_empty = False 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-True-False-False-False] _________ 861s 861s self = 861s consolidated = False, compute = False, use_dask = False, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-False-False-True] _________ 861s 861s self = 861s consolidated = True, compute = False, use_dask = False, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-False-False-None] _________ 861s 861s self = 861s consolidated = None, compute = False, use_dask = False, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-False-True-False] _________ 861s 861s self = 861s consolidated = False, compute = True, use_dask = False, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-False-True-True] __________ 861s 861s self = 861s consolidated = True, compute = True, use_dask = False, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-False-True-None] __________ 861s 861s self = 861s consolidated = None, compute = True, use_dask = False, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-True-False-False] _________ 861s 861s self = 861s consolidated = False, compute = False, use_dask = True, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-True-False-True] __________ 861s 861s self = 861s consolidated = True, compute = False, use_dask = True, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-True-False-None] __________ 861s 861s self = 861s consolidated = None, compute = False, use_dask = True, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-True-True-True-False] __________ 861s 861s self = 861s consolidated = False, compute = True, use_dask = True, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________ TestZarrDictStore.test_write_region[3-True-True-True-True] __________ 861s 861s self = 861s consolidated = True, compute = True, use_dask = True, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________ TestZarrDictStore.test_write_region[3-True-True-True-None] __________ 861s 861s self = 861s consolidated = None, compute = True, use_dask = True, write_empty = True 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_region[3-None-False-False-False] _________ 861s 861s self = 861s consolidated = False, compute = False, use_dask = False, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-False-False-True] _________ 861s 861s self = 861s consolidated = True, compute = False, use_dask = False, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-False-False-None] _________ 861s 861s self = 861s consolidated = None, compute = False, use_dask = False, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-False-True-False] _________ 861s 861s self = 861s consolidated = False, compute = True, use_dask = False, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-False-True-True] __________ 861s 861s self = 861s consolidated = True, compute = True, use_dask = False, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-False-True-None] __________ 861s 861s self = 861s consolidated = None, compute = True, use_dask = False, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-True-False-False] _________ 861s 861s self = 861s consolidated = False, compute = False, use_dask = True, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-True-False-True] __________ 861s 861s self = 861s consolidated = True, compute = False, use_dask = True, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-True-False-None] __________ 861s 861s self = 861s consolidated = None, compute = False, use_dask = True, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s assert_identical(actual, zeros) 861s for i in range(0, 10, 2): 861s region = {"x": slice(i, i + 2)} 861s > nonzeros.isel(region).to_zarr( 861s store, 861s region=region, 861s consolidated=consolidated, 861s write_empty_chunks=write_empty, 861s **self.version_kwargs, 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _________ TestZarrDictStore.test_write_region[3-None-True-True-False] __________ 861s 861s self = 861s consolidated = False, compute = True, use_dask = True, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________ TestZarrDictStore.test_write_region[3-None-True-True-True] __________ 861s 861s self = 861s consolidated = True, compute = True, use_dask = True, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________ TestZarrDictStore.test_write_region[3-None-True-True-None] __________ 861s 861s self = 861s consolidated = None, compute = True, use_dask = True, write_empty = None 861s 861s @pytest.mark.parametrize("consolidated", [False, True, None]) 861s @pytest.mark.parametrize("compute", [False, True]) 861s @pytest.mark.parametrize("use_dask", [False, True]) 861s @pytest.mark.parametrize("write_empty", [False, True, None]) 861s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 861s if (use_dask or not compute) and not has_dask: 861s pytest.skip("requires dask") 861s 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s 861s if use_dask: 861s zeros = zeros.chunk(2) 861s nonzeros = nonzeros.chunk(2) 861s 861s with self.create_zarr_target() as store: 861s zeros.to_zarr( 861s store, 861s consolidated=consolidated, 861s compute=compute, 861s encoding={"u": dict(chunks=2)}, 861s **self.version_kwargs, 861s ) 861s if compute: 861s > with xr.open_zarr( 861s store, consolidated=consolidated, **self.version_kwargs 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _______________ TestZarrDictStore.test_write_region_mode[3-None] _______________ 861s 861s self = 861s mode = None 861s 861s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 861s def test_write_region_mode(self, mode) -> None: 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s with self.create_zarr_target() as store: 861s zeros.to_zarr(store, **self.version_kwargs) 861s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 861s > nonzeros.isel(region).to_zarr( 861s store, region=region, mode=mode, **self.version_kwargs 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_write_region_mode[3-r+] ________________ 861s 861s self = 861s mode = 'r+' 861s 861s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 861s def test_write_region_mode(self, mode) -> None: 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s with self.create_zarr_target() as store: 861s zeros.to_zarr(store, **self.version_kwargs) 861s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 861s > nonzeros.isel(region).to_zarr( 861s store, region=region, mode=mode, **self.version_kwargs 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_write_region_mode[3-a] _________________ 861s 861s self = 861s mode = 'a' 861s 861s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 861s def test_write_region_mode(self, mode) -> None: 861s zeros = Dataset({"u": (("x",), np.zeros(10))}) 861s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 861s with self.create_zarr_target() as store: 861s zeros.to_zarr(store, **self.version_kwargs) 861s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 861s > nonzeros.isel(region).to_zarr( 861s store, region=region, mode=mode, **self.version_kwargs 861s ) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________ TestZarrDictStore.test_write_preexisting_override_metadata[3] _________ 861s 861s self = 861s 861s @requires_dask 861s def test_write_preexisting_override_metadata(self) -> None: 861s """Metadata should be overridden if mode="a" but not in mode="r+".""" 861s original = Dataset( 861s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 861s attrs={"global": "original"}, 861s ) 861s both_modified = Dataset( 861s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 861s attrs={"global": "modified"}, 861s ) 861s global_modified = Dataset( 861s {"u": (("x",), np.ones(10), {"variable": "original"})}, 861s attrs={"global": "modified"}, 861s ) 861s only_new_data = Dataset( 861s {"u": (("x",), np.ones(10), {"variable": "original"})}, 861s attrs={"global": "original"}, 861s ) 861s 861s with self.create_zarr_target() as store: 861s original.to_zarr(store, compute=False, **self.version_kwargs) 861s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 861s return to_zarr( # type: ignore[call-overload,misc] 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 861s dump_to_store(dataset, zstore, writer, encoding=encoding) 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 861s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 861s k: self.open_store_variable(name=k) for k in existing_variable_names 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'u' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_encoding_chunksizes[3] _________________ 861s 861s self = 861s 861s @requires_dask 861s def test_encoding_chunksizes(self) -> None: 861s # regression test for GH2278 861s # see also test_encoding_chunksizes_unlimited 861s nx, ny, nt = 4, 4, 5 861s original = xr.Dataset( 861s {}, 861s coords={ 861s "x": np.arange(nx), 861s "y": np.arange(ny), 861s "t": np.arange(nt), 861s }, 861s ) 861s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 861s original = original.chunk({"t": 1, "x": 2, "y": 2}) 861s 861s > with self.roundtrip(original) as ds1: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'v' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______ TestZarrDictStore.test_chunk_encoding_with_partial_dask_chunks[3] _______ 861s 861s self = 861s 861s @requires_dask 861s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 861s original = xr.Dataset( 861s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 861s ).chunk({"a": 3}) 861s 861s > with self.roundtrip( 861s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 861s ) as ds1: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDictStore.test_open_zarr_use_cftime[3] ________________ 861s 861s self = 861s 861s @requires_cftime 861s def test_open_zarr_use_cftime(self) -> None: 861s ds = create_test_data() 861s with self.create_zarr_target() as store_target: 861s ds.to_zarr(store_target, **self.version_kwargs) 861s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDictStore.test_write_read_select_write[3] _______________ 861s 861s self = 861s 861s def test_write_read_select_write(self) -> None: 861s # Test for https://github.com/pydata/xarray/issues/4084 861s ds = create_test_data() 861s 861s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 861s with self.create_zarr_target() as initial_store: 861s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 861s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________________ TestZarrDictStore.test_attributes[3-obj1] ___________________ 861s 861s self = 861s obj = Size: 8B 861s array(nan) 861s Attributes: 861s good: {'key': 'value'} 861s 861s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 861s def test_attributes(self, obj) -> None: 861s obj = obj.copy() 861s 861s obj.attrs["good"] = {"key": "value"} 861s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 861s with self.create_zarr_target() as store_target: 861s ds.to_zarr(store_target, **self.version_kwargs) 861s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 861s ds = open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'foo' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 861s 861s self = 861s dtype = 'datetime64[ns]' 861s 861s @requires_dask 861s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 861s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 861s # Generalized from @malmans2's test in PR #8253 861s original = create_test_data().astype(dtype).chunk(1) 861s > with self.roundtrip( 861s original, 861s open_kwargs={ 861s "chunks": {}, 861s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 861s }, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] __ 861s 861s self = 861s dtype = 'timedelta64[ns]' 861s 861s @requires_dask 861s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 861s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 861s # Generalized from @malmans2's test in PR #8253 861s original = create_test_data().astype(dtype).chunk(1) 861s > with self.roundtrip( 861s original, 861s open_kwargs={ 861s "chunks": {}, 861s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 861s }, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________ TestZarrDictStore.test_zarr_fill_value_setting[3-float] ____________ 861s 861s self = 861s dtype = 861s 861s @requires_dask 861s @pytest.mark.parametrize("dtype", [int, float]) 861s def test_zarr_fill_value_setting(self, dtype): 861s # When zarr_format=2, _FillValue sets fill_value 861s # When zarr_format=3, fill_value is set independently 861s # We test this by writing a dask array with compute=False, 861s # on read we should receive chunks filled with `fill_value` 861s fv = -1 861s ds = xr.Dataset( 861s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 861s ) 861s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 861s 861s zarr_format_2 = ( 861s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 861s ) or not has_zarr_v3 861s if zarr_format_2: 861s attr = "_FillValue" 861s expected.foo.attrs[attr] = fv 861s else: 861s attr = "fill_value" 861s if dtype is float: 861s # for floats, Xarray inserts a default `np.nan` 861s expected.foo.attrs["_FillValue"] = np.nan 861s 861s # turn off all decoding so we see what Zarr returns to us. 861s # Since chunks, are not written, we should receive on `fill_value` 861s open_kwargs = { 861s "mask_and_scale": False, 861s "consolidated": False, 861s "use_zarr_fill_value_as_mask": False, 861s } 861s save_kwargs = dict(compute=False, consolidated=False) 861s > with self.roundtrip( 861s ds, 861s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 861s open_kwargs=open_kwargs, 861s ) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'foo' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ___________ TestZarrDirectoryStore.test_zero_dimensional_variable[3] ___________ 861s 861s self = 861s 861s def test_zero_dimensional_variable(self) -> None: 861s expected = create_test_data() 861s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 861s expected["bytes_var"] = ([], b"foobar") 861s expected["string_var"] = ([], "foobar") 861s > with self.roundtrip(expected) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s __________________ TestZarrDirectoryStore.test_write_store[3] __________________ 861s 861s self = 861s 861s def test_write_store(self) -> None: 861s expected = create_test_data() 861s with self.create_store() as store: 861s expected.dump_to_store(store) 861s # we need to cf decode the store because it has time and 861s # non-dimension coordinates 861s > with xr.decode_cf(store) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 861s vars, attrs = obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDirectoryStore.test_roundtrip_test_data[3] ______________ 861s 861s self = 861s 861s def test_roundtrip_test_data(self) -> None: 861s expected = create_test_data() 861s > with self.roundtrip(expected) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s _____________________ TestZarrDirectoryStore.test_load[3] ______________________ 861s 861s self = 861s 861s def test_load(self) -> None: 861s expected = create_test_data() 861s 861s @contextlib.contextmanager 861s def assert_loads(vars=None): 861s if vars is None: 861s vars = expected 861s with self.roundtrip(expected) as actual: 861s for k, v in actual.variables.items(): 861s # IndexVariables are eagerly loaded into memory 861s assert v._in_memory == (k in actual.dims) 861s yield actual 861s for k, v in actual.variables.items(): 861s if k in vars: 861s assert v._in_memory 861s assert_identical(expected, actual) 861s 861s with pytest.raises(AssertionError): 861s # make sure the contextmanager works! 861s > with assert_loads() as ds: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 861s with self.roundtrip(expected) as actual: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ________________ TestZarrDirectoryStore.test_dataset_compute[3] ________________ 861s 861s self = 861s 861s def test_dataset_compute(self) -> None: 861s expected = create_test_data() 861s 861s > with self.roundtrip(expected) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDirectoryStore.test_roundtrip_object_dtype[3] _____________ 861s 861s self = 861s 861s def test_roundtrip_object_dtype(self) -> None: 861s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 861s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 861s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 861s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 861s strings = np.array(["ab", "cdef", "g"], dtype=object) 861s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 861s all_nans = np.array([np.nan, np.nan], dtype=object) 861s original = Dataset( 861s { 861s "floats": ("a", floats), 861s "floats_nans": ("a", floats_nans), 861s "bytes": ("b", bytes_), 861s "bytes_nans": ("b", bytes_nans), 861s "strings": ("b", strings), 861s "strings_nans": ("b", strings_nans), 861s "all_nans": ("c", all_nans), 861s "nan": ([], np.nan), 861s } 861s ) 861s expected = original.copy(deep=True) 861s > with self.roundtrip(original) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'nan' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ____________ TestZarrDirectoryStore.test_roundtrip_float64_data[3] _____________ 861s 861s self = 861s 861s def test_roundtrip_float64_data(self) -> None: 861s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 861s > with self.roundtrip(expected) as actual: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'x' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 861s ) 861s if self.zarr_group.metadata.zarr_format == 3: 861s encoding.update({"serializer": zarr_array.serializer}) 861s else: 861s encoding.update( 861s { 861s "compressor": zarr_array.compressor, 861s "filters": zarr_array.filters, 861s } 861s ) 861s 861s if self._use_zarr_fill_value_as_mask: 861s # Setting this attribute triggers CF decoding for missing values 861s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 861s if zarr_array.fill_value is not None: 861s attributes["_FillValue"] = zarr_array.fill_value 861s elif "_FillValue" in attributes: 861s original_zarr_dtype = zarr_array.metadata.data_type 861s attributes["_FillValue"] = FillValueCoder.decode( 861s > attributes["_FillValue"], original_zarr_dtype.value 861s ) 861s E AttributeError: 'Float64' object has no attribute 'value' 861s 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 861s ______________ TestZarrDirectoryStore.test_orthogonal_indexing[3] ______________ 861s 861s self = 861s 861s def test_orthogonal_indexing(self) -> None: 861s in_memory = create_test_data() 861s > with self.roundtrip(in_memory) as on_disk: 861s 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 861s with self.open(store_target, **open_kwargs) as ds: 861s /usr/lib/python3.14/contextlib.py:141: in __enter__ 861s return next(self.gen) 861s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 861s with xr.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 861s backend_ds = backend.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 861s ds = store_entrypoint.open_dataset( 861s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 861s vars, attrs = filename_or_obj.load() 861s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 861s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 861s return Frozen(dict(*args, **kwargs)) 861s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 861s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 861s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 861s 861s self = , name = 'dim2' 861s 861s def open_store_variable(self, name): 861s zarr_array = self.members[name] 861s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 861s try_nczarr = self._mode == "r" 861s dimensions, attributes = _get_zarr_dims_and_attrs( 861s zarr_array, DIMENSION_KEY, try_nczarr 861s ) 861s attributes = dict(attributes) 861s 861s encoding = { 861s "chunks": zarr_array.chunks, 861s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 861s } 861s 861s if _zarr_v3(): 861s encoding.update( 861s { 861s "compressors": zarr_array.compressors, 861s "filters": zarr_array.filters, 861s "shards": zarr_array.shards, 861s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_vectorized_indexing[3] ______________ 862s 862s self = 862s 862s def test_vectorized_indexing(self) -> None: 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_vectorized_indexing_negative_step[3] _______ 862s 862s self = 862s 862s def test_vectorized_indexing_negative_step(self) -> None: 862s # use dask explicitly when present 862s open_kwargs: dict[str, Any] | None 862s if has_dask: 862s open_kwargs = {"chunks": {}} 862s else: 862s open_kwargs = None 862s in_memory = create_test_data() 862s 862s def multiple_indexing(indexers): 862s # make sure a sequence of lazy indexings certainly works. 862s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 862s actual = on_disk["var3"] 862s expected = in_memory["var3"] 862s for ind in indexers: 862s actual = actual.isel(ind) 862s expected = expected.isel(ind) 862s # make sure the array is not yet loaded into memory 862s assert not actual.variable._in_memory 862s assert_identical(expected, actual.load()) 862s 862s # with negative step slice. 862s indexers = [ 862s { 862s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 862s "dim3": slice(-1, 1, -1), 862s } 862s ] 862s > multiple_indexing(indexers) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 862s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________ TestZarrDirectoryStore.test_outer_indexing_reversed[3] ____________ 862s 862s self = 862s 862s def test_outer_indexing_reversed(self) -> None: 862s # regression test for GH6560 862s ds = xr.Dataset( 862s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 862s ) 862s 862s > with self.roundtrip(ds) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'z' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrDirectoryStore.test_isel_dataarray[3] _________________ 862s 862s self = 862s 862s def test_isel_dataarray(self) -> None: 862s # Make sure isel works lazily. GH:issue:1688 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ___________ TestZarrDirectoryStore.test_array_type_after_indexing[3] ___________ 862s 862s self = 862s 862s def test_array_type_after_indexing(self) -> None: 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________________ TestZarrDirectoryStore.test_dropna[3] _____________________ 862s 862s self = 862s 862s def test_dropna(self) -> None: 862s # regression test for GH:issue:1694 862s a = np.random.randn(4, 3) 862s a[1, 1] = np.nan 862s in_memory = xr.Dataset( 862s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 862s ) 862s 862s assert_identical( 862s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 862s ) 862s 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'a' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_ondisk_after_print[3] _______________ 862s 862s self = 862s 862s def test_ondisk_after_print(self) -> None: 862s """Make sure print does not load file into memory""" 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________ TestZarrDirectoryStore.test_roundtrip_bytes_with_fill_value[3] ________ 862s 862s self = 862s 862s def test_roundtrip_bytes_with_fill_value(self) -> None: 862s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 862s encoding = {"_FillValue": b"X", "dtype": "S1"} 862s original = Dataset({"x": ("t", values, {}, encoding)}) 862s expected = original.copy(deep=True) 862s > with self.roundtrip(original) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value0-False] ______ 862s 862s self = 862s fill_value = np.int8(-1), exp_fill_warning = False 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value1-True] ______ 862s 862s self = 862s fill_value = np.uint8(255), exp_fill_warning = True 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3--1-False] __________ 862s 862s self = 862s fill_value = -1, exp_fill_warning = False 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3-255-True] __________ 862s 862s self = 862s fill_value = 255, exp_fill_warning = True 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 862s 862s self = 862s 862s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 862s original = self._create_cf_dataset() 862s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = 862s name = 'det_lim' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrDirectoryStore.test_coordinate_variables_after_dataset_roundtrip[3] __ 862s 862s self = 862s 862s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 862s original = self._create_cf_dataset() 862s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = 862s name = 'det_lim' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 862s 862s self = 862s 862s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 862s self, 862s ) -> None: 862s original = self._create_cf_dataset() 862s # The DataArray roundtrip should have the same warnings as the 862s # Dataset, but we already tested for those, so just go for the 862s # new warnings. It would appear that there is no way to tell 862s # pytest "This warning and also this warning should both be 862s # present". 862s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 862s # needs the to_dataset. The other backends should be fine 862s # without it. 862s with pytest.warns( 862s UserWarning, 862s match=( 862s r"Variable\(s\) referenced in bounds not in variables: " 862s r"\['l(at|ong)itude_bnds'\]" 862s ), 862s ): 862s > with self.roundtrip( 862s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'ln_p' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s 862s During handling of the above exception, another exception occurred: 862s 862s self = 862s 862s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 862s self, 862s ) -> None: 862s original = self._create_cf_dataset() 862s # The DataArray roundtrip should have the same warnings as the 862s # Dataset, but we already tested for those, so just go for the 862s # new warnings. It would appear that there is no way to tell 862s # pytest "This warning and also this warning should both be 862s # present". 862s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 862s # needs the to_dataset. The other backends should be fine 862s # without it. 862s > with pytest.warns( 862s UserWarning, 862s match=( 862s r"Variable\(s\) referenced in bounds not in variables: " 862s r"\['l(at|ong)itude_bnds'\]" 862s ), 862s ): 862s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 862s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 862s 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.')]. 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 862s ________________ TestZarrDirectoryStore.test_encoding_kwarg[3] _________________ 862s 862s self = 862s 862s def test_encoding_kwarg(self) -> None: 862s ds = Dataset({"x": ("y", np.arange(10.0))}) 862s 862s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 862s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float32' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_default_fill_value[3] _______________ 862s 862s self = 862s 862s def test_default_fill_value(self) -> None: 862s # Test default encoding for float: 862s ds = Dataset({"x": ("y", np.arange(10.0))}) 862s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 862s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float32' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord[3] ______ 862s 862s self = 862s 862s def test_explicitly_omit_fill_value_in_coord(self) -> None: 862s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 862s ds.y.encoding["_FillValue"] = None 862s > with self.roundtrip(ds) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 862s 862s self = 862s 862s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 862s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 862s kwargs = dict(encoding={"y": {"_FillValue": None}}) 862s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_encoding_same_dtype[3] ______________ 862s 862s self = 862s 862s def test_encoding_same_dtype(self) -> None: 862s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 862s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 862s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float32' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________ TestZarrDirectoryStore.test_append_overwrite_values[3] ____________ 862s 862s self = 862s 862s def test_append_overwrite_values(self) -> None: 862s # regression for GH1215 862s data = create_test_data() 862s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 862s self.save(data, tmp_file, mode="w") 862s data["var2"][:] = -999 862s data["var9"] = data["var2"] * 3 862s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 862s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'var2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-False] __________ 862s 862s self = 862s consolidated = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s def test_roundtrip_consolidated(self, consolidated) -> None: 862s expected = create_test_data() 862s > with self.roundtrip( 862s expected, 862s save_kwargs={"consolidated": consolidated}, 862s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'var3' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-True] __________ 862s 862s self = 862s consolidated = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s def test_roundtrip_consolidated(self, consolidated) -> None: 862s expected = create_test_data() 862s > with self.roundtrip( 862s expected, 862s save_kwargs={"consolidated": consolidated}, 862s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-None] __________ 862s 862s self = 862s consolidated = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s def test_roundtrip_consolidated(self, consolidated) -> None: 862s expected = create_test_data() 862s > with self.roundtrip( 862s expected, 862s save_kwargs={"consolidated": consolidated}, 862s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________ TestZarrDirectoryStore.test_read_non_consolidated_warning[3] _________ 862s 862s self = 862s 862s def test_read_non_consolidated_warning(self) -> None: 862s expected = create_test_data() 862s with self.create_zarr_target() as store: 862s self.save( 862s expected, store_target=store, consolidated=False, **self.version_kwargs 862s ) 862s with pytest.warns( 862s RuntimeWarning, 862s match="Failed to open Zarr store with consolidated", 862s ): 862s > with xr.open_zarr(store, **self.version_kwargs) as ds: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_non_existent_store[3] _______________ 862s 862s self = 862s 862s def test_non_existent_store(self) -> None: 862s with pytest.raises( 862s FileNotFoundError, match="(No such file or directory|Unable to find group)" 862s ): 862s > xr.open_zarr(f"{uuid.uuid4()}") 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 862s store = ZarrStore.open_group( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 862s ) = _get_open_params( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 862s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 862s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 862s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 862s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 862s raise return_result 862s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 862s return await coro 862s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 862s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 862s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 862s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 862s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 862s store = await make_store(store_like, mode=mode, storage_options=storage_options) 862s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 862s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 862s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 862s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 862s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 862s await store._open() 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/64080214-93e7-4067-a234-42fb91e5a118') 862s 862s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 862s if not self.read_only: 862s self.root.mkdir(parents=True, exist_ok=True) 862s 862s if not self.root.exists(): 862s > raise FileNotFoundError(f"{self.root} does not exist") 862s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/64080214-93e7-4067-a234-42fb91e5a118 does not exist 862s 862s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 862s 862s During handling of the above exception, another exception occurred: 862s 862s self = 862s 862s def test_non_existent_store(self) -> None: 862s > with pytest.raises( 862s FileNotFoundError, match="(No such file or directory|Unable to find group)" 862s ): 862s E AssertionError: Regex pattern did not match. 862s E Regex: '(No such file or directory|Unable to find group)' 862s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/64080214-93e7-4067-a234-42fb91e5a118 does not exist' 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 862s __________________ TestZarrDirectoryStore.test_auto_chunk[3] ___________________ 862s 862s self = 862s 862s @requires_dask 862s def test_auto_chunk(self) -> None: 862s original = create_test_data().chunk() 862s 862s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________________ TestZarrDirectoryStore.test_manual_chunk[3] __________________ 862s 862s self = 862s 862s @requires_dask 862s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 862s def test_manual_chunk(self) -> None: 862s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 862s 862s # Using chunks = None should return non-chunked arrays 862s open_kwargs: dict[str, Any] = {"chunks": None} 862s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____________ TestZarrDirectoryStore.test_warning_on_bad_chunks[3] _____________ 862s 862s self = 862s 862s @requires_dask 862s def test_warning_on_bad_chunks(self) -> None: 862s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 862s 862s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 862s for chunks in bad_chunks: 862s kwargs = {"chunks": chunks} 862s with pytest.warns(UserWarning): 862s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ___________ TestZarrDirectoryStore.test_write_uneven_dask_chunks[3] ____________ 862s 862s self = 862s 862s @requires_dask 862s def test_write_uneven_dask_chunks(self) -> None: 862s # regression for GH#2225 862s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 862s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrDirectoryStore.test_chunk_encoding[3] _________________ 862s 862s self = 862s 862s def test_chunk_encoding(self) -> None: 862s # These datasets have no dask chunks. All chunking specified in 862s # encoding 862s data = create_test_data() 862s chunks = (5, 5) 862s data["var2"].encoding.update({"chunks": chunks}) 862s 862s > with self.roundtrip(data) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrDirectoryStore.test_shard_encoding[3] _________________ 862s 862s self = 862s 862s def test_shard_encoding(self) -> None: 862s # These datasets have no dask chunks. All chunking/sharding specified in 862s # encoding 862s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 862s data = create_test_data() 862s chunks = (1, 1) 862s shards = (5, 5) 862s data["var2"].encoding.update({"chunks": chunks}) 862s data["var2"].encoding.update({"shards": shards}) 862s > with self.roundtrip(data) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________ TestZarrDirectoryStore.test_write_persistence_modes[3-None] __________ 862s 862s self = 862s group = None 862s 862s @pytest.mark.parametrize("group", [None, "group1"]) 862s def test_write_persistence_modes(self, group) -> None: 862s original = create_test_data() 862s 862s # overwrite mode 862s > with self.roundtrip( 862s original, 862s save_kwargs={"mode": "w", "group": group}, 862s open_kwargs={"group": group}, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________ TestZarrDirectoryStore.test_write_persistence_modes[3-group1] _________ 862s 862s self = 862s group = 'group1' 862s 862s @pytest.mark.parametrize("group", [None, "group1"]) 862s def test_write_persistence_modes(self, group) -> None: 862s original = create_test_data() 862s 862s # overwrite mode 862s > with self.roundtrip( 862s original, 862s save_kwargs={"mode": "w", "group": group}, 862s open_kwargs={"group": group}, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_compressor_encoding[3] ______________ 862s 862s self = 862s 862s def test_compressor_encoding(self) -> None: 862s # specify a custom compressor 862s original = create_test_data() 862s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 862s encoding_key = "compressors" 862s # all parameters need to be explicitly specified in order for the comparison to pass below 862s encoding = { 862s "serializer": zarr.codecs.BytesCodec(endian="little"), 862s encoding_key: ( 862s zarr.codecs.BloscCodec( 862s cname="zstd", 862s clevel=3, 862s shuffle="shuffle", 862s typesize=8, 862s blocksize=0, 862s ), 862s ), 862s } 862s else: 862s from numcodecs.blosc import Blosc 862s 862s encoding_key = "compressors" if has_zarr_v3 else "compressor" 862s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 862s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 862s 862s save_kwargs = dict(encoding={"var1": encoding}) 862s 862s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____________________ TestZarrDirectoryStore.test_group[3] _____________________ 862s 862s self = 862s 862s def test_group(self) -> None: 862s original = create_test_data() 862s group = "some/random/path" 862s > with self.roundtrip( 862s original, save_kwargs={"group": group}, open_kwargs={"group": group} 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________________ TestZarrDirectoryStore.test_append_write[3] __________________ 862s 862s self = 862s 862s def test_append_write(self) -> None: 862s > super().test_append_write() 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 862s with self.roundtrip_append(data) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 862s self.save(data[[key]], path, mode=mode, **save_kwargs) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 862s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____ TestZarrDirectoryStore.test_append_with_append_dim_not_set_raises[3] _____ 862s 862s self = 862s 862s def test_append_with_append_dim_not_set_raises(self) -> None: 862s ds, ds_to_append, _ = create_append_test_data() 862s with self.create_zarr_target() as store_target: 862s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 862s with pytest.raises(ValueError, match="different dimension sizes"): 862s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'da' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-U] _____ 862s 862s self = 862s dtype = 'U' 862s 862s @pytest.mark.parametrize("dtype", ["U", "S"]) 862s def test_append_string_length_mismatch_works(self, dtype) -> None: 862s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 862s # ...but it probably would if we used object dtype 862s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 862s expected = xr.concat([ds, ds_to_append], dim="time") 862s with self.create_zarr_target() as store_target: 862s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 862s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 862s _validate_datatypes_for_zarr_append( 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s vname = 'temperature' 862s existing_var = Size: 96B 862s [3 values with dtype=>U8] 862s new_var = Size: 60B 862s array(['abc', 'def', 'ghijk'], dtype='>U5') 862s 862s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 862s """If variable exists in the store, confirm dtype of the data to append is compatible with 862s existing dtype. 862s """ 862s if ( 862s np.issubdtype(new_var.dtype, np.number) 862s or np.issubdtype(new_var.dtype, np.datetime64) 862s or np.issubdtype(new_var.dtype, np.bool_) 862s or new_var.dtype == object 862s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 862s ): 862s # We can skip dtype equality checks under two conditions: (1) if the var to append is 862s # new to the dataset, because in this case there is no existing var to compare it to; 862s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 862s # we can be confident appending won't cause problems. Examples of dtypes which are not 862s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 862s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 862s f"and dataset to append. Store has dtype {existing_var.dtype} but " 862s f"dataset to append has dtype {new_var.dtype}." 862s ) 862s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype >U8 but dataset to append has dtype >U5. 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 862s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-S] _____ 862s 862s self = 862s dtype = 'S' 862s 862s @pytest.mark.parametrize("dtype", ["U", "S"]) 862s def test_append_string_length_mismatch_works(self, dtype) -> None: 862s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 862s # ...but it probably would if we used object dtype 862s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 862s expected = xr.concat([ds, ds_to_append], dim="time") 862s with self.create_zarr_target() as store_target: 862s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 862s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 862s _validate_datatypes_for_zarr_append( 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s vname = 'temperature' 862s existing_var = Size: 6B 862s [3 values with dtype=|S2] 862s new_var = Size: 9B 862s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 862s 862s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 862s """If variable exists in the store, confirm dtype of the data to append is compatible with 862s existing dtype. 862s """ 862s if ( 862s np.issubdtype(new_var.dtype, np.number) 862s or np.issubdtype(new_var.dtype, np.datetime64) 862s or np.issubdtype(new_var.dtype, np.bool_) 862s or new_var.dtype == object 862s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 862s ): 862s # We can skip dtype equality checks under two conditions: (1) if the var to append is 862s # new to the dataset, because in this case there is no existing var to compare it to; 862s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 862s # we can be confident appending won't cause problems. Examples of dtypes which are not 862s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 862s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 862s f"and dataset to append. Store has dtype {existing_var.dtype} but " 862s f"dataset to append has dtype {new_var.dtype}." 862s ) 862s 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. 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 862s ___ TestZarrDirectoryStore.test_check_encoding_is_consistent_after_append[3] ___ 862s 862s self = 862s 862s def test_check_encoding_is_consistent_after_append(self) -> None: 862s ds, ds_to_append, _ = create_append_test_data() 862s 862s # check encoding consistency 862s with self.create_zarr_target() as store_target: 862s import numcodecs 862s 862s encoding_value: Any 862s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 862s compressor = zarr.codecs.BloscCodec() 862s else: 862s compressor = numcodecs.Blosc() 862s encoding_key = "compressors" if has_zarr_v3 else "compressor" 862s encoding_value = (compressor,) if has_zarr_v3 else compressor 862s 862s encoding = {"da": {encoding_key: encoding_value}} 862s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 862s > original_ds = xr.open_dataset( 862s store_target, engine="zarr", **self.version_kwargs 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'da' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ___________ TestZarrDirectoryStore.test_append_with_new_variable[3] ____________ 862s 862s self = 862s 862s def test_append_with_new_variable(self) -> None: 862s ds, ds_to_append, ds_with_new_var = create_append_test_data() 862s 862s # check append mode for new variable 862s with self.create_zarr_target() as store_target: 862s combined = xr.concat([ds, ds_to_append], dim="time") 862s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 862s assert_identical( 862s combined, 862s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'da' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_append_with_append_dim_no_overwrite[3] ______ 862s 862s self = 862s 862s def test_append_with_append_dim_no_overwrite(self) -> None: 862s ds, ds_to_append, _ = create_append_test_data() 862s with self.create_zarr_target() as store_target: 862s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 862s original = xr.concat([ds, ds_to_append], dim="time") 862s original2 = xr.concat([original, ds_to_append], dim="time") 862s 862s # overwrite a coordinate; 862s # for mode='a-', this will not get written to the store 862s # because it does not have the append_dim as a dim 862s lon = ds_to_append.lon.to_numpy().copy() 862s lon[:] = -999 862s ds_to_append["lon"] = lon 862s > ds_to_append.to_zarr( 862s store_target, mode="a-", append_dim="time", **self.version_kwargs 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'da' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________ TestZarrDirectoryStore.test_to_zarr_compute_false_roundtrip[3] ________ 862s 862s self = 862s 862s @requires_dask 862s def test_to_zarr_compute_false_roundtrip(self) -> None: 862s from dask.delayed import Delayed 862s 862s original = create_test_data().chunk() 862s 862s with self.create_zarr_target() as store: 862s delayed_obj = self.save(original, store, compute=False) 862s assert isinstance(delayed_obj, Delayed) 862s 862s # make sure target store has not been written to yet 862s with pytest.raises(AssertionError): 862s > with self.open(store) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____ TestZarrDirectoryStore.test_to_zarr_append_compute_false_roundtrip[3] _____ 862s 862s self = 862s 862s @requires_dask 862s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 862s from dask.delayed import Delayed 862s 862s ds, ds_to_append, _ = create_append_test_data() 862s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 862s 862s with pytest.warns(SerializationWarning): 862s with self.create_zarr_target() as store: 862s delayed_obj = self.save(ds, store, compute=False, mode="w") 862s assert isinstance(delayed_obj, Delayed) 862s 862s with pytest.raises(AssertionError): 862s > with self.open(store) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'da' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_save_emptydim[3-False] ______________ 862s 862s self = 862s chunk = False 862s 862s @pytest.mark.parametrize("chunk", [False, True]) 862s def test_save_emptydim(self, chunk) -> None: 862s if chunk and not has_dask: 862s pytest.skip("requires dask") 862s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 862s if chunk: 862s ds = ds.chunk({}) # chunk dataset to save dask array 862s > with self.roundtrip(ds) as ds_reload: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_save_emptydim[3-True] _______________ 862s 862s self = 862s chunk = True 862s 862s @pytest.mark.parametrize("chunk", [False, True]) 862s def test_save_emptydim(self, chunk) -> None: 862s if chunk and not has_dask: 862s pytest.skip("requires dask") 862s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 862s if chunk: 862s ds = ds.chunk({}) # chunk dataset to save dask array 862s > with self.roundtrip(ds) as ds_reload: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ___ TestZarrDirectoryStore.test_no_warning_from_open_emptydim_with_chunks[3] ___ 862s 862s self = 862s 862s @requires_dask 862s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 862s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 862s with assert_no_warnings(): 862s with warnings.catch_warnings(): 862s warnings.filterwarnings( 862s "ignore", 862s message=".*Zarr format 3 specification.*", 862s category=UserWarning, 862s ) 862s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____ TestZarrDirectoryStore.test_write_region[3-False-False-False-False] ______ 862s 862s self = 862s consolidated = False, compute = False, use_dask = False, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-True] ______ 862s 862s self = 862s consolidated = True, compute = False, use_dask = False, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-None] ______ 862s 862s self = 862s consolidated = None, compute = False, use_dask = False, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-False] ______ 862s 862s self = 862s consolidated = False, compute = True, use_dask = False, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-True] _______ 862s 862s self = 862s consolidated = True, compute = True, use_dask = False, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-None] _______ 862s 862s self = 862s consolidated = None, compute = True, use_dask = False, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-False] ______ 862s 862s self = 862s consolidated = False, compute = False, use_dask = True, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-True] _______ 862s 862s self = 862s consolidated = True, compute = False, use_dask = True, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-None] _______ 862s 862s self = 862s consolidated = None, compute = False, use_dask = True, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-False-True-True-False] _______ 862s 862s self = 862s consolidated = False, compute = True, use_dask = True, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-True] _______ 862s 862s self = 862s consolidated = True, compute = True, use_dask = True, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-None] _______ 862s 862s self = 862s consolidated = None, compute = True, use_dask = True, write_empty = False 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-False] ______ 862s 862s self = 862s consolidated = False, compute = False, use_dask = False, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-True] _______ 862s 862s self = 862s consolidated = True, compute = False, use_dask = False, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-None] _______ 862s 862s self = 862s consolidated = None, compute = False, use_dask = False, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-True-False-True-False] _______ 862s 862s self = 862s consolidated = False, compute = True, use_dask = False, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-True] _______ 862s 862s self = 862s consolidated = True, compute = True, use_dask = False, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-None] _______ 862s 862s self = 862s consolidated = None, compute = True, use_dask = False, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-True-True-False-False] _______ 862s 862s self = 862s consolidated = False, compute = False, use_dask = True, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-True] _______ 862s 862s self = 862s consolidated = True, compute = False, use_dask = True, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-None] _______ 862s 862s self = 862s consolidated = None, compute = False, use_dask = True, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-False] _______ 862s 862s self = 862s consolidated = False, compute = True, use_dask = True, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-True] ________ 862s 862s self = 862s consolidated = True, compute = True, use_dask = True, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-None] ________ 862s 862s self = 862s consolidated = None, compute = True, use_dask = True, write_empty = True 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-False] ______ 862s 862s self = 862s consolidated = False, compute = False, use_dask = False, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-True] _______ 862s 862s self = 862s consolidated = True, compute = False, use_dask = False, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-None] _______ 862s 862s self = 862s consolidated = None, compute = False, use_dask = False, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-None-False-True-False] _______ 862s 862s self = 862s consolidated = False, compute = True, use_dask = False, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-True] _______ 862s 862s self = 862s consolidated = True, compute = True, use_dask = False, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-None] _______ 862s 862s self = 862s consolidated = None, compute = True, use_dask = False, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_region[3-None-True-False-False] _______ 862s 862s self = 862s consolidated = False, compute = False, use_dask = True, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-True] _______ 862s 862s self = 862s consolidated = True, compute = False, use_dask = True, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-None] _______ 862s 862s self = 862s consolidated = None, compute = False, use_dask = True, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s assert_identical(actual, zeros) 862s for i in range(0, 10, 2): 862s region = {"x": slice(i, i + 2)} 862s > nonzeros.isel(region).to_zarr( 862s store, 862s region=region, 862s consolidated=consolidated, 862s write_empty_chunks=write_empty, 862s **self.version_kwargs, 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-False] _______ 862s 862s self = 862s consolidated = False, compute = True, use_dask = True, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-True] ________ 862s 862s self = 862s consolidated = True, compute = True, use_dask = True, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-None] ________ 862s 862s self = 862s consolidated = None, compute = True, use_dask = True, write_empty = None 862s 862s @pytest.mark.parametrize("consolidated", [False, True, None]) 862s @pytest.mark.parametrize("compute", [False, True]) 862s @pytest.mark.parametrize("use_dask", [False, True]) 862s @pytest.mark.parametrize("write_empty", [False, True, None]) 862s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 862s if (use_dask or not compute) and not has_dask: 862s pytest.skip("requires dask") 862s 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s 862s if use_dask: 862s zeros = zeros.chunk(2) 862s nonzeros = nonzeros.chunk(2) 862s 862s with self.create_zarr_target() as store: 862s zeros.to_zarr( 862s store, 862s consolidated=consolidated, 862s compute=compute, 862s encoding={"u": dict(chunks=2)}, 862s **self.version_kwargs, 862s ) 862s if compute: 862s > with xr.open_zarr( 862s store, consolidated=consolidated, **self.version_kwargs 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________ TestZarrDirectoryStore.test_write_region_mode[3-None] _____________ 862s 862s self = 862s mode = None 862s 862s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 862s def test_write_region_mode(self, mode) -> None: 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s with self.create_zarr_target() as store: 862s zeros.to_zarr(store, **self.version_kwargs) 862s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 862s > nonzeros.isel(region).to_zarr( 862s store, region=region, mode=mode, **self.version_kwargs 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____________ TestZarrDirectoryStore.test_write_region_mode[3-r+] ______________ 862s 862s self = 862s mode = 'r+' 862s 862s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 862s def test_write_region_mode(self, mode) -> None: 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s with self.create_zarr_target() as store: 862s zeros.to_zarr(store, **self.version_kwargs) 862s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 862s > nonzeros.isel(region).to_zarr( 862s store, region=region, mode=mode, **self.version_kwargs 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_write_region_mode[3-a] ______________ 862s 862s self = 862s mode = 'a' 862s 862s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 862s def test_write_region_mode(self, mode) -> None: 862s zeros = Dataset({"u": (("x",), np.zeros(10))}) 862s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 862s with self.create_zarr_target() as store: 862s zeros.to_zarr(store, **self.version_kwargs) 862s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 862s > nonzeros.isel(region).to_zarr( 862s store, region=region, mode=mode, **self.version_kwargs 862s ) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______ TestZarrDirectoryStore.test_write_preexisting_override_metadata[3] ______ 862s 862s self = 862s 862s @requires_dask 862s def test_write_preexisting_override_metadata(self) -> None: 862s """Metadata should be overridden if mode="a" but not in mode="r+".""" 862s original = Dataset( 862s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 862s attrs={"global": "original"}, 862s ) 862s both_modified = Dataset( 862s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 862s attrs={"global": "modified"}, 862s ) 862s global_modified = Dataset( 862s {"u": (("x",), np.ones(10), {"variable": "original"})}, 862s attrs={"global": "modified"}, 862s ) 862s only_new_data = Dataset( 862s {"u": (("x",), np.ones(10), {"variable": "original"})}, 862s attrs={"global": "original"}, 862s ) 862s 862s with self.create_zarr_target() as store: 862s original.to_zarr(store, compute=False, **self.version_kwargs) 862s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 862s return to_zarr( # type: ignore[call-overload,misc] 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 862s dump_to_store(dataset, zstore, writer, encoding=encoding) 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 862s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 862s k: self.open_store_variable(name=k) for k in existing_variable_names 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'u' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrDirectoryStore.test_encoding_chunksizes[3] ______________ 862s 862s self = 862s 862s @requires_dask 862s def test_encoding_chunksizes(self) -> None: 862s # regression test for GH2278 862s # see also test_encoding_chunksizes_unlimited 862s nx, ny, nt = 4, 4, 5 862s original = xr.Dataset( 862s {}, 862s coords={ 862s "x": np.arange(nx), 862s "y": np.arange(ny), 862s "t": np.arange(nt), 862s }, 862s ) 862s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 862s original = original.chunk({"t": 1, "x": 2, "y": 2}) 862s 862s > with self.roundtrip(original) as ds1: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'v' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____ TestZarrDirectoryStore.test_chunk_encoding_with_partial_dask_chunks[3] ____ 862s 862s self = 862s 862s @requires_dask 862s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 862s original = xr.Dataset( 862s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 862s ).chunk({"a": 3}) 862s 862s > with self.roundtrip( 862s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 862s ) as ds1: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____________ TestZarrDirectoryStore.test_open_zarr_use_cftime[3] ______________ 862s 862s self = 862s 862s @requires_cftime 862s def test_open_zarr_use_cftime(self) -> None: 862s ds = create_test_data() 862s with self.create_zarr_target() as store_target: 862s ds.to_zarr(store_target, **self.version_kwargs) 862s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________ TestZarrDirectoryStore.test_write_read_select_write[3] ____________ 862s 862s self = 862s 862s def test_write_read_select_write(self) -> None: 862s # Test for https://github.com/pydata/xarray/issues/4084 862s ds = create_test_data() 862s 862s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 862s with self.create_zarr_target() as initial_store: 862s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 862s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrDirectoryStore.test_attributes[3-obj1] ________________ 862s 862s self = 862s obj = Size: 8B 862s array(nan) 862s Attributes: 862s good: {'key': 'value'} 862s 862s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 862s def test_attributes(self, obj) -> None: 862s obj = obj.copy() 862s 862s obj.attrs["good"] = {"key": "value"} 862s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 862s with self.create_zarr_target() as store_target: 862s ds.to_zarr(store_target, **self.version_kwargs) 862s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 862s ds = open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'foo' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] _ 862s 862s self = 862s dtype = 'datetime64[ns]' 862s 862s @requires_dask 862s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 862s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 862s # Generalized from @malmans2's test in PR #8253 862s original = create_test_data().astype(dtype).chunk(1) 862s > with self.roundtrip( 862s original, 862s open_kwargs={ 862s "chunks": {}, 862s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 862s }, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 862s 862s self = 862s dtype = 'timedelta64[ns]' 862s 862s @requires_dask 862s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 862s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 862s # Generalized from @malmans2's test in PR #8253 862s original = create_test_data().astype(dtype).chunk(1) 862s > with self.roundtrip( 862s original, 862s open_kwargs={ 862s "chunks": {}, 862s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 862s }, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________ TestZarrDirectoryStore.test_zarr_fill_value_setting[3-float] _________ 862s 862s self = 862s dtype = 862s 862s @requires_dask 862s @pytest.mark.parametrize("dtype", [int, float]) 862s def test_zarr_fill_value_setting(self, dtype): 862s # When zarr_format=2, _FillValue sets fill_value 862s # When zarr_format=3, fill_value is set independently 862s # We test this by writing a dask array with compute=False, 862s # on read we should receive chunks filled with `fill_value` 862s fv = -1 862s ds = xr.Dataset( 862s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 862s ) 862s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 862s 862s zarr_format_2 = ( 862s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 862s ) or not has_zarr_v3 862s if zarr_format_2: 862s attr = "_FillValue" 862s expected.foo.attrs[attr] = fv 862s else: 862s attr = "fill_value" 862s if dtype is float: 862s # for floats, Xarray inserts a default `np.nan` 862s expected.foo.attrs["_FillValue"] = np.nan 862s 862s # turn off all decoding so we see what Zarr returns to us. 862s # Since chunks, are not written, we should receive on `fill_value` 862s open_kwargs = { 862s "mask_and_scale": False, 862s "consolidated": False, 862s "use_zarr_fill_value_as_mask": False, 862s } 862s save_kwargs = dict(compute=False, consolidated=False) 862s > with self.roundtrip( 862s ds, 862s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 862s open_kwargs=open_kwargs, 862s ) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'foo' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____________ TestZarrWriteEmpty.test_zero_dimensional_variable[3] _____________ 862s 862s self = 862s 862s def test_zero_dimensional_variable(self) -> None: 862s expected = create_test_data() 862s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 862s expected["bytes_var"] = ([], b"foobar") 862s expected["string_var"] = ([], "foobar") 862s > with self.roundtrip(expected) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________________ TestZarrWriteEmpty.test_write_store[3] ____________________ 862s 862s self = 862s 862s def test_write_store(self) -> None: 862s expected = create_test_data() 862s with self.create_store() as store: 862s expected.dump_to_store(store) 862s # we need to cf decode the store because it has time and 862s # non-dimension coordinates 862s > with xr.decode_cf(store) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 862s vars, attrs = obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrWriteEmpty.test_roundtrip_test_data[3] ________________ 862s 862s self = 862s 862s def test_roundtrip_test_data(self) -> None: 862s expected = create_test_data() 862s > with self.roundtrip(expected) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______________________ TestZarrWriteEmpty.test_load[3] ________________________ 862s 862s self = 862s 862s def test_load(self) -> None: 862s expected = create_test_data() 862s 862s @contextlib.contextmanager 862s def assert_loads(vars=None): 862s if vars is None: 862s vars = expected 862s with self.roundtrip(expected) as actual: 862s for k, v in actual.variables.items(): 862s # IndexVariables are eagerly loaded into memory 862s assert v._in_memory == (k in actual.dims) 862s yield actual 862s for k, v in actual.variables.items(): 862s if k in vars: 862s assert v._in_memory 862s assert_identical(expected, actual) 862s 862s with pytest.raises(AssertionError): 862s # make sure the contextmanager works! 862s > with assert_loads() as ds: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 862s with self.roundtrip(expected) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________________ TestZarrWriteEmpty.test_dataset_compute[3] __________________ 862s 862s self = 862s 862s def test_dataset_compute(self) -> None: 862s expected = create_test_data() 862s 862s > with self.roundtrip(expected) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrWriteEmpty.test_roundtrip_object_dtype[3] _______________ 862s 862s self = 862s 862s def test_roundtrip_object_dtype(self) -> None: 862s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 862s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 862s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 862s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 862s strings = np.array(["ab", "cdef", "g"], dtype=object) 862s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 862s all_nans = np.array([np.nan, np.nan], dtype=object) 862s original = Dataset( 862s { 862s "floats": ("a", floats), 862s "floats_nans": ("a", floats_nans), 862s "bytes": ("b", bytes_), 862s "bytes_nans": ("b", bytes_nans), 862s "strings": ("b", strings), 862s "strings_nans": ("b", strings_nans), 862s "all_nans": ("c", all_nans), 862s "nan": ([], np.nan), 862s } 862s ) 862s expected = original.copy(deep=True) 862s > with self.roundtrip(original) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'nan' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrWriteEmpty.test_roundtrip_float64_data[3] _______________ 862s 862s self = 862s 862s def test_roundtrip_float64_data(self) -> None: 862s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 862s > with self.roundtrip(expected) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrWriteEmpty.test_orthogonal_indexing[3] ________________ 862s 862s self = 862s 862s def test_orthogonal_indexing(self) -> None: 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrWriteEmpty.test_vectorized_indexing[3] ________________ 862s 862s self = 862s 862s def test_vectorized_indexing(self) -> None: 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _________ TestZarrWriteEmpty.test_vectorized_indexing_negative_step[3] _________ 862s 862s self = 862s 862s def test_vectorized_indexing_negative_step(self) -> None: 862s # use dask explicitly when present 862s open_kwargs: dict[str, Any] | None 862s if has_dask: 862s open_kwargs = {"chunks": {}} 862s else: 862s open_kwargs = None 862s in_memory = create_test_data() 862s 862s def multiple_indexing(indexers): 862s # make sure a sequence of lazy indexings certainly works. 862s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 862s actual = on_disk["var3"] 862s expected = in_memory["var3"] 862s for ind in indexers: 862s actual = actual.isel(ind) 862s expected = expected.isel(ind) 862s # make sure the array is not yet loaded into memory 862s assert not actual.variable._in_memory 862s assert_identical(expected, actual.load()) 862s 862s # with negative step slice. 862s indexers = [ 862s { 862s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 862s "dim3": slice(-1, 1, -1), 862s } 862s ] 862s > multiple_indexing(indexers) 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 862s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________ TestZarrWriteEmpty.test_outer_indexing_reversed[3] ______________ 862s 862s self = 862s 862s def test_outer_indexing_reversed(self) -> None: 862s # regression test for GH6560 862s ds = xr.Dataset( 862s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 862s ) 862s 862s > with self.roundtrip(ds) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'z' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________________ TestZarrWriteEmpty.test_isel_dataarray[3] ___________________ 862s 862s self = 862s 862s def test_isel_dataarray(self) -> None: 862s # Make sure isel works lazily. GH:issue:1688 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _____________ TestZarrWriteEmpty.test_array_type_after_indexing[3] _____________ 862s 862s self = 862s 862s def test_array_type_after_indexing(self) -> None: 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ______________________ TestZarrWriteEmpty.test_dropna[3] _______________________ 862s 862s self = 862s 862s def test_dropna(self) -> None: 862s # regression test for GH:issue:1694 862s a = np.random.randn(4, 3) 862s a[1, 1] = np.nan 862s in_memory = xr.Dataset( 862s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 862s ) 862s 862s assert_identical( 862s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 862s ) 862s 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'a' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________________ TestZarrWriteEmpty.test_ondisk_after_print[3] _________________ 862s 862s self = 862s 862s def test_ondisk_after_print(self) -> None: 862s """Make sure print does not load file into memory""" 862s in_memory = create_test_data() 862s > with self.roundtrip(in_memory) as on_disk: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'dim2' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Float64' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s __________ TestZarrWriteEmpty.test_roundtrip_bytes_with_fill_value[3] __________ 862s 862s self = 862s 862s def test_roundtrip_bytes_with_fill_value(self) -> None: 862s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 862s encoding = {"_FillValue": b"X", "dtype": "S1"} 862s original = Dataset({"x": ("t", values, {}, encoding)}) 862s expected = original.copy(deep=True) 862s > with self.roundtrip(original) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _______ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value0-False] ________ 862s 862s self = 862s fill_value = np.int8(-1), exp_fill_warning = False 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value1-True] ________ 862s 862s self = 862s fill_value = np.uint8(255), exp_fill_warning = True 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3--1-False] ____________ 862s 862s self = 862s fill_value = -1, exp_fill_warning = False 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-255-True] ____________ 862s 862s self = 862s fill_value = 255, exp_fill_warning = True 862s 862s @pytest.mark.parametrize( 862s ("fill_value", "exp_fill_warning"), 862s [ 862s (np.int8(-1), False), 862s (np.uint8(255), True), 862s (-1, False), 862s (255, True), 862s ], 862s ) 862s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 862s @contextlib.contextmanager 862s def _roundtrip_with_warnings(*args, **kwargs): 862s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 862s if exp_fill_warning and is_np2: 862s warn_checker: contextlib.AbstractContextManager = pytest.warns( 862s SerializationWarning, 862s match="_FillValue attribute can't be represented", 862s ) 862s else: 862s warn_checker = contextlib.nullcontext() 862s with warn_checker: 862s with self.roundtrip(*args, **kwargs) as actual: 862s yield actual 862s 862s # regression/numpy2 test for 862s encoding = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s "dtype": "i1", 862s } 862s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 862s decoded = Dataset({"x": ("t", x, {}, encoding)}) 862s 862s attributes = { 862s "_FillValue": fill_value, 862s "_Unsigned": "true", 862s } 862s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 862s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 862s encoded = Dataset({"x": ("t", sb, attributes)}) 862s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 862s 862s > with _roundtrip_with_warnings(decoded) as actual: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 862s with self.roundtrip(*args, **kwargs) as actual: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 862s return Frozen(dict(*args, **kwargs)) 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s 862s self = , name = 'x' 862s 862s def open_store_variable(self, name): 862s zarr_array = self.members[name] 862s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 862s try_nczarr = self._mode == "r" 862s dimensions, attributes = _get_zarr_dims_and_attrs( 862s zarr_array, DIMENSION_KEY, try_nczarr 862s ) 862s attributes = dict(attributes) 862s 862s encoding = { 862s "chunks": zarr_array.chunks, 862s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 862s } 862s 862s if _zarr_v3(): 862s encoding.update( 862s { 862s "compressors": zarr_array.compressors, 862s "filters": zarr_array.filters, 862s "shards": zarr_array.shards, 862s } 862s ) 862s if self.zarr_group.metadata.zarr_format == 3: 862s encoding.update({"serializer": zarr_array.serializer}) 862s else: 862s encoding.update( 862s { 862s "compressor": zarr_array.compressor, 862s "filters": zarr_array.filters, 862s } 862s ) 862s 862s if self._use_zarr_fill_value_as_mask: 862s # Setting this attribute triggers CF decoding for missing values 862s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 862s if zarr_array.fill_value is not None: 862s attributes["_FillValue"] = zarr_array.fill_value 862s elif "_FillValue" in attributes: 862s original_zarr_dtype = zarr_array.metadata.data_type 862s attributes["_FillValue"] = FillValueCoder.decode( 862s > attributes["_FillValue"], original_zarr_dtype.value 862s ) 862s E AttributeError: 'Int8' object has no attribute 'value' 862s 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 862s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 862s 862s self = 862s 862s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 862s original = self._create_cf_dataset() 862s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 862s 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 862s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 862s with self.open(store_target, **open_kwargs) as ds: 862s /usr/lib/python3.14/contextlib.py:141: in __enter__ 862s return next(self.gen) 862s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 862s with xr.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 862s backend_ds = backend.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 862s ds = store_entrypoint.open_dataset( 862s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 862s vars, attrs = filename_or_obj.load() 862s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 862s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 862s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 862s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = 863s name = 'det_lim' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___ TestZarrWriteEmpty.test_coordinate_variables_after_dataset_roundtrip[3] ____ 863s 863s self = 863s 863s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 863s original = self._create_cf_dataset() 863s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = 863s name = 'det_lim' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 863s 863s self = 863s 863s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 863s self, 863s ) -> None: 863s original = self._create_cf_dataset() 863s # The DataArray roundtrip should have the same warnings as the 863s # Dataset, but we already tested for those, so just go for the 863s # new warnings. It would appear that there is no way to tell 863s # pytest "This warning and also this warning should both be 863s # present". 863s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 863s # needs the to_dataset. The other backends should be fine 863s # without it. 863s with pytest.warns( 863s UserWarning, 863s match=( 863s r"Variable\(s\) referenced in bounds not in variables: " 863s r"\['l(at|ong)itude_bnds'\]" 863s ), 863s ): 863s > with self.roundtrip( 863s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'ln_p' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s 863s During handling of the above exception, another exception occurred: 863s 863s self = 863s 863s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 863s self, 863s ) -> None: 863s original = self._create_cf_dataset() 863s # The DataArray roundtrip should have the same warnings as the 863s # Dataset, but we already tested for those, so just go for the 863s # new warnings. It would appear that there is no way to tell 863s # pytest "This warning and also this warning should both be 863s # present". 863s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 863s # needs the to_dataset. The other backends should be fine 863s # without it. 863s > with pytest.warns( 863s UserWarning, 863s match=( 863s r"Variable\(s\) referenced in bounds not in variables: " 863s r"\['l(at|ong)itude_bnds'\]" 863s ), 863s ): 863s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 863s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 863s 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.')]. 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 863s __________________ TestZarrWriteEmpty.test_encoding_kwarg[3] ___________________ 863s 863s self = 863s 863s def test_encoding_kwarg(self) -> None: 863s ds = Dataset({"x": ("y", np.arange(10.0))}) 863s 863s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 863s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float32' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_default_fill_value[3] _________________ 863s 863s self = 863s 863s def test_default_fill_value(self) -> None: 863s # Test default encoding for float: 863s ds = Dataset({"x": ("y", np.arange(10.0))}) 863s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 863s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float32' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord[3] ________ 863s 863s self = 863s 863s def test_explicitly_omit_fill_value_in_coord(self) -> None: 863s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 863s ds.y.encoding["_FillValue"] = None 863s > with self.roundtrip(ds) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 863s 863s self = 863s 863s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 863s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 863s kwargs = dict(encoding={"y": {"_FillValue": None}}) 863s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_encoding_same_dtype[3] ________________ 863s 863s self = 863s 863s def test_encoding_same_dtype(self) -> None: 863s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 863s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 863s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float32' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_append_overwrite_values[3] ______________ 863s 863s self = 863s 863s def test_append_overwrite_values(self) -> None: 863s # regression for GH1215 863s data = create_test_data() 863s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 863s self.save(data, tmp_file, mode="w") 863s data["var2"][:] = -999 863s data["var9"] = data["var2"] * 3 863s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 863s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'var2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-False] ____________ 863s 863s self = 863s consolidated = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s def test_roundtrip_consolidated(self, consolidated) -> None: 863s expected = create_test_data() 863s > with self.roundtrip( 863s expected, 863s save_kwargs={"consolidated": consolidated}, 863s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-True] ____________ 863s 863s self = 863s consolidated = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s def test_roundtrip_consolidated(self, consolidated) -> None: 863s expected = create_test_data() 863s > with self.roundtrip( 863s expected, 863s save_kwargs={"consolidated": consolidated}, 863s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-None] ____________ 863s 863s self = 863s consolidated = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s def test_roundtrip_consolidated(self, consolidated) -> None: 863s expected = create_test_data() 863s > with self.roundtrip( 863s expected, 863s save_kwargs={"consolidated": consolidated}, 863s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___________ TestZarrWriteEmpty.test_read_non_consolidated_warning[3] ___________ 863s 863s self = 863s 863s def test_read_non_consolidated_warning(self) -> None: 863s expected = create_test_data() 863s with self.create_zarr_target() as store: 863s self.save( 863s expected, store_target=store, consolidated=False, **self.version_kwargs 863s ) 863s with pytest.warns( 863s RuntimeWarning, 863s match="Failed to open Zarr store with consolidated", 863s ): 863s > with xr.open_zarr(store, **self.version_kwargs) as ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'var3' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_non_existent_store[3] _________________ 863s 863s self = 863s 863s def test_non_existent_store(self) -> None: 863s with pytest.raises( 863s FileNotFoundError, match="(No such file or directory|Unable to find group)" 863s ): 863s > xr.open_zarr(f"{uuid.uuid4()}") 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 863s store = ZarrStore.open_group( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 863s ) = _get_open_params( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 863s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 863s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 863s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 863s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 863s raise return_result 863s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 863s return await coro 863s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 863s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 863s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 863s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 863s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 863s store = await make_store(store_like, mode=mode, storage_options=storage_options) 863s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 863s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 863s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 863s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 863s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 863s await store._open() 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/9e569358-d70a-4973-85a8-8881b403e25e') 863s 863s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 863s if not self.read_only: 863s self.root.mkdir(parents=True, exist_ok=True) 863s 863s if not self.root.exists(): 863s > raise FileNotFoundError(f"{self.root} does not exist") 863s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/9e569358-d70a-4973-85a8-8881b403e25e does not exist 863s 863s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 863s 863s During handling of the above exception, another exception occurred: 863s 863s self = 863s 863s def test_non_existent_store(self) -> None: 863s > with pytest.raises( 863s FileNotFoundError, match="(No such file or directory|Unable to find group)" 863s ): 863s E AssertionError: Regex pattern did not match. 863s E Regex: '(No such file or directory|Unable to find group)' 863s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/9e569358-d70a-4973-85a8-8881b403e25e does not exist' 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 863s ____________________ TestZarrWriteEmpty.test_auto_chunk[3] _____________________ 863s 863s self = 863s 863s @requires_dask 863s def test_auto_chunk(self) -> None: 863s original = create_test_data().chunk() 863s 863s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___________________ TestZarrWriteEmpty.test_manual_chunk[3] ____________________ 863s 863s self = 863s 863s @requires_dask 863s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 863s def test_manual_chunk(self) -> None: 863s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 863s 863s # Using chunks = None should return non-chunked arrays 863s open_kwargs: dict[str, Any] = {"chunks": None} 863s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_warning_on_bad_chunks[3] _______________ 863s 863s self = 863s 863s @requires_dask 863s def test_warning_on_bad_chunks(self) -> None: 863s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 863s 863s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 863s for chunks in bad_chunks: 863s kwargs = {"chunks": chunks} 863s with pytest.warns(UserWarning): 863s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____________ TestZarrWriteEmpty.test_write_uneven_dask_chunks[3] ______________ 863s 863s self = 863s 863s @requires_dask 863s def test_write_uneven_dask_chunks(self) -> None: 863s # regression for GH#2225 863s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 863s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s __________________ TestZarrWriteEmpty.test_chunk_encoding[3] ___________________ 863s 863s self = 863s 863s def test_chunk_encoding(self) -> None: 863s # These datasets have no dask chunks. All chunking specified in 863s # encoding 863s data = create_test_data() 863s chunks = (5, 5) 863s data["var2"].encoding.update({"chunks": chunks}) 863s 863s > with self.roundtrip(data) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s __________________ TestZarrWriteEmpty.test_shard_encoding[3] ___________________ 863s 863s self = 863s 863s def test_shard_encoding(self) -> None: 863s # These datasets have no dask chunks. All chunking/sharding specified in 863s # encoding 863s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 863s data = create_test_data() 863s chunks = (1, 1) 863s shards = (5, 5) 863s data["var2"].encoding.update({"chunks": chunks}) 863s data["var2"].encoding.update({"shards": shards}) 863s > with self.roundtrip(data) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___________ TestZarrWriteEmpty.test_write_persistence_modes[3-None] ____________ 863s 863s self = 863s group = None 863s 863s @pytest.mark.parametrize("group", [None, "group1"]) 863s def test_write_persistence_modes(self, group) -> None: 863s original = create_test_data() 863s 863s # overwrite mode 863s > with self.roundtrip( 863s original, 863s save_kwargs={"mode": "w", "group": group}, 863s open_kwargs={"group": group}, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s __________ TestZarrWriteEmpty.test_write_persistence_modes[3-group1] ___________ 863s 863s self = 863s group = 'group1' 863s 863s @pytest.mark.parametrize("group", [None, "group1"]) 863s def test_write_persistence_modes(self, group) -> None: 863s original = create_test_data() 863s 863s # overwrite mode 863s > with self.roundtrip( 863s original, 863s save_kwargs={"mode": "w", "group": group}, 863s open_kwargs={"group": group}, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_compressor_encoding[3] ________________ 863s 863s self = 863s 863s def test_compressor_encoding(self) -> None: 863s # specify a custom compressor 863s original = create_test_data() 863s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 863s encoding_key = "compressors" 863s # all parameters need to be explicitly specified in order for the comparison to pass below 863s encoding = { 863s "serializer": zarr.codecs.BytesCodec(endian="little"), 863s encoding_key: ( 863s zarr.codecs.BloscCodec( 863s cname="zstd", 863s clevel=3, 863s shuffle="shuffle", 863s typesize=8, 863s blocksize=0, 863s ), 863s ), 863s } 863s else: 863s from numcodecs.blosc import Blosc 863s 863s encoding_key = "compressors" if has_zarr_v3 else "compressor" 863s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 863s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 863s 863s save_kwargs = dict(encoding={"var1": encoding}) 863s 863s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________________ TestZarrWriteEmpty.test_group[3] _______________________ 863s 863s self = 863s 863s def test_group(self) -> None: 863s original = create_test_data() 863s group = "some/random/path" 863s > with self.roundtrip( 863s original, save_kwargs={"group": group}, open_kwargs={"group": group} 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___________________ TestZarrWriteEmpty.test_append_write[3] ____________________ 863s 863s self = 863s 863s def test_append_write(self) -> None: 863s > super().test_append_write() 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 863s with self.roundtrip_append(data) as actual: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 863s self.save(data[[key]], path, mode=mode, **save_kwargs) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 863s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______ TestZarrWriteEmpty.test_append_with_append_dim_not_set_raises[3] _______ 863s 863s self = 863s 863s def test_append_with_append_dim_not_set_raises(self) -> None: 863s ds, ds_to_append, _ = create_append_test_data() 863s with self.create_zarr_target() as store_target: 863s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 863s with pytest.raises(ValueError, match="different dimension sizes"): 863s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'da' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-U] _______ 863s 863s self = 863s dtype = 'U' 863s 863s @pytest.mark.parametrize("dtype", ["U", "S"]) 863s def test_append_string_length_mismatch_works(self, dtype) -> None: 863s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 863s # ...but it probably would if we used object dtype 863s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 863s expected = xr.concat([ds, ds_to_append], dim="time") 863s with self.create_zarr_target() as store_target: 863s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 863s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 863s _validate_datatypes_for_zarr_append( 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s vname = 'temperature' 863s existing_var = Size: 96B 863s [3 values with dtype=>U8] 863s new_var = Size: 60B 863s array(['abc', 'def', 'ghijk'], dtype='>U5') 863s 863s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 863s """If variable exists in the store, confirm dtype of the data to append is compatible with 863s existing dtype. 863s """ 863s if ( 863s np.issubdtype(new_var.dtype, np.number) 863s or np.issubdtype(new_var.dtype, np.datetime64) 863s or np.issubdtype(new_var.dtype, np.bool_) 863s or new_var.dtype == object 863s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 863s ): 863s # We can skip dtype equality checks under two conditions: (1) if the var to append is 863s # new to the dataset, because in this case there is no existing var to compare it to; 863s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 863s # we can be confident appending won't cause problems. Examples of dtypes which are not 863s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 863s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 863s f"and dataset to append. Store has dtype {existing_var.dtype} but " 863s f"dataset to append has dtype {new_var.dtype}." 863s ) 863s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype >U8 but dataset to append has dtype >U5. 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 863s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-S] _______ 863s 863s self = 863s dtype = 'S' 863s 863s @pytest.mark.parametrize("dtype", ["U", "S"]) 863s def test_append_string_length_mismatch_works(self, dtype) -> None: 863s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 863s # ...but it probably would if we used object dtype 863s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 863s expected = xr.concat([ds, ds_to_append], dim="time") 863s with self.create_zarr_target() as store_target: 863s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 863s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 863s _validate_datatypes_for_zarr_append( 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s vname = 'temperature' 863s existing_var = Size: 6B 863s [3 values with dtype=|S2] 863s new_var = Size: 9B 863s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 863s 863s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 863s """If variable exists in the store, confirm dtype of the data to append is compatible with 863s existing dtype. 863s """ 863s if ( 863s np.issubdtype(new_var.dtype, np.number) 863s or np.issubdtype(new_var.dtype, np.datetime64) 863s or np.issubdtype(new_var.dtype, np.bool_) 863s or new_var.dtype == object 863s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 863s ): 863s # We can skip dtype equality checks under two conditions: (1) if the var to append is 863s # new to the dataset, because in this case there is no existing var to compare it to; 863s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 863s # we can be confident appending won't cause problems. Examples of dtypes which are not 863s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 863s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 863s f"and dataset to append. Store has dtype {existing_var.dtype} but " 863s f"dataset to append has dtype {new_var.dtype}." 863s ) 863s 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. 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 863s _____ TestZarrWriteEmpty.test_check_encoding_is_consistent_after_append[3] _____ 863s 863s self = 863s 863s def test_check_encoding_is_consistent_after_append(self) -> None: 863s ds, ds_to_append, _ = create_append_test_data() 863s 863s # check encoding consistency 863s with self.create_zarr_target() as store_target: 863s import numcodecs 863s 863s encoding_value: Any 863s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 863s compressor = zarr.codecs.BloscCodec() 863s else: 863s compressor = numcodecs.Blosc() 863s encoding_key = "compressors" if has_zarr_v3 else "compressor" 863s encoding_value = (compressor,) if has_zarr_v3 else compressor 863s 863s encoding = {"da": {encoding_key: encoding_value}} 863s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 863s > original_ds = xr.open_dataset( 863s store_target, engine="zarr", **self.version_kwargs 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'da' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____________ TestZarrWriteEmpty.test_append_with_new_variable[3] ______________ 863s 863s self = 863s 863s def test_append_with_new_variable(self) -> None: 863s ds, ds_to_append, ds_with_new_var = create_append_test_data() 863s 863s # check append mode for new variable 863s with self.create_zarr_target() as store_target: 863s combined = xr.concat([ds, ds_to_append], dim="time") 863s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 863s assert_identical( 863s combined, 863s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'da' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_append_with_append_dim_no_overwrite[3] ________ 863s 863s self = 863s 863s def test_append_with_append_dim_no_overwrite(self) -> None: 863s ds, ds_to_append, _ = create_append_test_data() 863s with self.create_zarr_target() as store_target: 863s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 863s original = xr.concat([ds, ds_to_append], dim="time") 863s original2 = xr.concat([original, ds_to_append], dim="time") 863s 863s # overwrite a coordinate; 863s # for mode='a-', this will not get written to the store 863s # because it does not have the append_dim as a dim 863s lon = ds_to_append.lon.to_numpy().copy() 863s lon[:] = -999 863s ds_to_append["lon"] = lon 863s > ds_to_append.to_zarr( 863s store_target, mode="a-", append_dim="time", **self.version_kwargs 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'da' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s __________ TestZarrWriteEmpty.test_to_zarr_compute_false_roundtrip[3] __________ 863s 863s self = 863s 863s @requires_dask 863s def test_to_zarr_compute_false_roundtrip(self) -> None: 863s from dask.delayed import Delayed 863s 863s original = create_test_data().chunk() 863s 863s with self.create_zarr_target() as store: 863s delayed_obj = self.save(original, store, compute=False) 863s assert isinstance(delayed_obj, Delayed) 863s 863s # make sure target store has not been written to yet 863s with pytest.raises(AssertionError): 863s > with self.open(store) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______ TestZarrWriteEmpty.test_to_zarr_append_compute_false_roundtrip[3] _______ 863s 863s self = 863s 863s @requires_dask 863s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 863s from dask.delayed import Delayed 863s 863s ds, ds_to_append, _ = create_append_test_data() 863s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 863s 863s with pytest.warns(SerializationWarning): 863s with self.create_zarr_target() as store: 863s delayed_obj = self.save(ds, store, compute=False, mode="w") 863s assert isinstance(delayed_obj, Delayed) 863s 863s with pytest.raises(AssertionError): 863s > with self.open(store) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'da' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_save_emptydim[3-False] ________________ 863s 863s self = 863s chunk = False 863s 863s @pytest.mark.parametrize("chunk", [False, True]) 863s def test_save_emptydim(self, chunk) -> None: 863s if chunk and not has_dask: 863s pytest.skip("requires dask") 863s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 863s if chunk: 863s ds = ds.chunk({}) # chunk dataset to save dask array 863s > with self.roundtrip(ds) as ds_reload: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_save_emptydim[3-True] _________________ 863s 863s self = 863s chunk = True 863s 863s @pytest.mark.parametrize("chunk", [False, True]) 863s def test_save_emptydim(self, chunk) -> None: 863s if chunk and not has_dask: 863s pytest.skip("requires dask") 863s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 863s if chunk: 863s ds = ds.chunk({}) # chunk dataset to save dask array 863s > with self.roundtrip(ds) as ds_reload: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____ TestZarrWriteEmpty.test_no_warning_from_open_emptydim_with_chunks[3] _____ 863s 863s self = 863s 863s @requires_dask 863s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 863s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 863s with assert_no_warnings(): 863s with warnings.catch_warnings(): 863s warnings.filterwarnings( 863s "ignore", 863s message=".*Zarr format 3 specification.*", 863s category=UserWarning, 863s ) 863s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______ TestZarrWriteEmpty.test_write_region[3-False-False-False-False] ________ 863s 863s self = 863s consolidated = False, compute = False, use_dask = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-True] ________ 863s 863s self = 863s consolidated = True, compute = False, use_dask = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-None] ________ 863s 863s self = 863s consolidated = None, compute = False, use_dask = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-False] ________ 863s 863s self = 863s consolidated = False, compute = True, use_dask = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-True] _________ 863s 863s self = 863s consolidated = True, compute = True, use_dask = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-None] _________ 863s 863s self = 863s consolidated = None, compute = True, use_dask = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-False] ________ 863s 863s self = 863s consolidated = False, compute = False, use_dask = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-True] _________ 863s 863s self = 863s consolidated = True, compute = False, use_dask = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-None] _________ 863s 863s self = 863s consolidated = None, compute = False, use_dask = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-False-True-True-False] _________ 863s 863s self = 863s consolidated = False, compute = True, use_dask = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-True] _________ 863s 863s self = 863s consolidated = True, compute = True, use_dask = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-None] _________ 863s 863s self = 863s consolidated = None, compute = True, use_dask = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-False] ________ 863s 863s self = 863s consolidated = False, compute = False, use_dask = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-True] _________ 863s 863s self = 863s consolidated = True, compute = False, use_dask = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-None] _________ 863s 863s self = 863s consolidated = None, compute = False, use_dask = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-True-False-True-False] _________ 863s 863s self = 863s consolidated = False, compute = True, use_dask = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-True] _________ 863s 863s self = 863s consolidated = True, compute = True, use_dask = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-None] _________ 863s 863s self = 863s consolidated = None, compute = True, use_dask = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-True-True-False-False] _________ 863s 863s self = 863s consolidated = False, compute = False, use_dask = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-True] _________ 863s 863s self = 863s consolidated = True, compute = False, use_dask = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-None] _________ 863s 863s self = 863s consolidated = None, compute = False, use_dask = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-False] _________ 863s 863s self = 863s consolidated = False, compute = True, use_dask = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-True] __________ 863s 863s self = 863s consolidated = True, compute = True, use_dask = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-None] __________ 863s 863s self = 863s consolidated = None, compute = True, use_dask = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-False] ________ 863s 863s self = 863s consolidated = False, compute = False, use_dask = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-True] _________ 863s 863s self = 863s consolidated = True, compute = False, use_dask = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-None] _________ 863s 863s self = 863s consolidated = None, compute = False, use_dask = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-None-False-True-False] _________ 863s 863s self = 863s consolidated = False, compute = True, use_dask = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-True] _________ 863s 863s self = 863s consolidated = True, compute = True, use_dask = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-None] _________ 863s 863s self = 863s consolidated = None, compute = True, use_dask = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_region[3-None-True-False-False] _________ 863s 863s self = 863s consolidated = False, compute = False, use_dask = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-True] _________ 863s 863s self = 863s consolidated = True, compute = False, use_dask = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-None] _________ 863s 863s self = 863s consolidated = None, compute = False, use_dask = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s assert_identical(actual, zeros) 863s for i in range(0, 10, 2): 863s region = {"x": slice(i, i + 2)} 863s > nonzeros.isel(region).to_zarr( 863s store, 863s region=region, 863s consolidated=consolidated, 863s write_empty_chunks=write_empty, 863s **self.version_kwargs, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-False] _________ 863s 863s self = 863s consolidated = False, compute = True, use_dask = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-True] __________ 863s 863s self = 863s consolidated = True, compute = True, use_dask = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-None] __________ 863s 863s self = 863s consolidated = None, compute = True, use_dask = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [False, True, None]) 863s @pytest.mark.parametrize("compute", [False, True]) 863s @pytest.mark.parametrize("use_dask", [False, True]) 863s @pytest.mark.parametrize("write_empty", [False, True, None]) 863s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 863s if (use_dask or not compute) and not has_dask: 863s pytest.skip("requires dask") 863s 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s 863s if use_dask: 863s zeros = zeros.chunk(2) 863s nonzeros = nonzeros.chunk(2) 863s 863s with self.create_zarr_target() as store: 863s zeros.to_zarr( 863s store, 863s consolidated=consolidated, 863s compute=compute, 863s encoding={"u": dict(chunks=2)}, 863s **self.version_kwargs, 863s ) 863s if compute: 863s > with xr.open_zarr( 863s store, consolidated=consolidated, **self.version_kwargs 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_region_mode[3-None] _______________ 863s 863s self = 863s mode = None 863s 863s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 863s def test_write_region_mode(self, mode) -> None: 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s with self.create_zarr_target() as store: 863s zeros.to_zarr(store, **self.version_kwargs) 863s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 863s > nonzeros.isel(region).to_zarr( 863s store, region=region, mode=mode, **self.version_kwargs 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_write_region_mode[3-r+] ________________ 863s 863s self = 863s mode = 'r+' 863s 863s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 863s def test_write_region_mode(self, mode) -> None: 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s with self.create_zarr_target() as store: 863s zeros.to_zarr(store, **self.version_kwargs) 863s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 863s > nonzeros.isel(region).to_zarr( 863s store, region=region, mode=mode, **self.version_kwargs 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_write_region_mode[3-a] ________________ 863s 863s self = 863s mode = 'a' 863s 863s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 863s def test_write_region_mode(self, mode) -> None: 863s zeros = Dataset({"u": (("x",), np.zeros(10))}) 863s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 863s with self.create_zarr_target() as store: 863s zeros.to_zarr(store, **self.version_kwargs) 863s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 863s > nonzeros.isel(region).to_zarr( 863s store, region=region, mode=mode, **self.version_kwargs 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________ TestZarrWriteEmpty.test_write_preexisting_override_metadata[3] ________ 863s 863s self = 863s 863s @requires_dask 863s def test_write_preexisting_override_metadata(self) -> None: 863s """Metadata should be overridden if mode="a" but not in mode="r+".""" 863s original = Dataset( 863s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 863s attrs={"global": "original"}, 863s ) 863s both_modified = Dataset( 863s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 863s attrs={"global": "modified"}, 863s ) 863s global_modified = Dataset( 863s {"u": (("x",), np.ones(10), {"variable": "original"})}, 863s attrs={"global": "modified"}, 863s ) 863s only_new_data = Dataset( 863s {"u": (("x",), np.ones(10), {"variable": "original"})}, 863s attrs={"global": "original"}, 863s ) 863s 863s with self.create_zarr_target() as store: 863s original.to_zarr(store, compute=False, **self.version_kwargs) 863s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'u' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ________________ TestZarrWriteEmpty.test_encoding_chunksizes[3] ________________ 863s 863s self = 863s 863s @requires_dask 863s def test_encoding_chunksizes(self) -> None: 863s # regression test for GH2278 863s # see also test_encoding_chunksizes_unlimited 863s nx, ny, nt = 4, 4, 5 863s original = xr.Dataset( 863s {}, 863s coords={ 863s "x": np.arange(nx), 863s "y": np.arange(ny), 863s "t": np.arange(nt), 863s }, 863s ) 863s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 863s original = original.chunk({"t": 1, "x": 2, "y": 2}) 863s 863s > with self.roundtrip(original) as ds1: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'v' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______ TestZarrWriteEmpty.test_chunk_encoding_with_partial_dask_chunks[3] ______ 863s 863s self = 863s 863s @requires_dask 863s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 863s original = xr.Dataset( 863s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 863s ).chunk({"a": 3}) 863s 863s > with self.roundtrip( 863s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 863s ) as ds1: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'x' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_open_zarr_use_cftime[3] ________________ 863s 863s self = 863s 863s @requires_cftime 863s def test_open_zarr_use_cftime(self) -> None: 863s ds = create_test_data() 863s with self.create_zarr_target() as store_target: 863s ds.to_zarr(store_target, **self.version_kwargs) 863s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_read_select_write[3] ______________ 863s 863s self = 863s 863s def test_write_read_select_write(self) -> None: 863s # Test for https://github.com/pydata/xarray/issues/4084 863s ds = create_test_data() 863s 863s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 863s with self.create_zarr_target() as initial_store: 863s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 863s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s __________________ TestZarrWriteEmpty.test_attributes[3-obj1] __________________ 863s 863s self = 863s obj = Size: 8B 863s array(nan) 863s Attributes: 863s good: {'key': 'value'} 863s 863s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 863s def test_attributes(self, obj) -> None: 863s obj = obj.copy() 863s 863s obj.attrs["good"] = {"key": "value"} 863s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 863s with self.create_zarr_target() as store_target: 863s ds.to_zarr(store_target, **self.version_kwargs) 863s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 863s ds = open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'foo' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 863s 863s self = 863s dtype = 'datetime64[ns]' 863s 863s @requires_dask 863s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 863s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 863s # Generalized from @malmans2's test in PR #8253 863s original = create_test_data().astype(dtype).chunk(1) 863s > with self.roundtrip( 863s original, 863s open_kwargs={ 863s "chunks": {}, 863s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 863s }, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 863s 863s self = 863s dtype = 'timedelta64[ns]' 863s 863s @requires_dask 863s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 863s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 863s # Generalized from @malmans2's test in PR #8253 863s original = create_test_data().astype(dtype).chunk(1) 863s > with self.roundtrip( 863s original, 863s open_kwargs={ 863s "chunks": {}, 863s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 863s }, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'dim2' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ___________ TestZarrWriteEmpty.test_zarr_fill_value_setting[3-float] ___________ 863s 863s self = 863s dtype = 863s 863s @requires_dask 863s @pytest.mark.parametrize("dtype", [int, float]) 863s def test_zarr_fill_value_setting(self, dtype): 863s # When zarr_format=2, _FillValue sets fill_value 863s # When zarr_format=3, fill_value is set independently 863s # We test this by writing a dask array with compute=False, 863s # on read we should receive chunks filled with `fill_value` 863s fv = -1 863s ds = xr.Dataset( 863s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 863s ) 863s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 863s 863s zarr_format_2 = ( 863s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 863s ) or not has_zarr_v3 863s if zarr_format_2: 863s attr = "_FillValue" 863s expected.foo.attrs[attr] = fv 863s else: 863s attr = "fill_value" 863s if dtype is float: 863s # for floats, Xarray inserts a default `np.nan` 863s expected.foo.attrs["_FillValue"] = np.nan 863s 863s # turn off all decoding so we see what Zarr returns to us. 863s # Since chunks, are not written, we should receive on `fill_value` 863s open_kwargs = { 863s "mask_and_scale": False, 863s "consolidated": False, 863s "use_zarr_fill_value_as_mask": False, 863s } 863s save_kwargs = dict(compute=False, consolidated=False) 863s > with self.roundtrip( 863s ds, 863s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 863s open_kwargs=open_kwargs, 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 863s with self.open(store_target, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 863s with xr.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 863s ds = store_entrypoint.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 863s vars, attrs = filename_or_obj.load() 863s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 863s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 863s return Frozen(dict(*args, **kwargs)) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 863s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'foo' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_write_empty[3-True-True] _______________ 863s 863s self = 863s consolidated = True, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_empty[3-True-False] _______________ 863s 863s self = 863s consolidated = False, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_write_empty[3-True-None] _______________ 863s 863s self = 863s consolidated = None, write_empty = True 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_empty[3-False-True] _______________ 863s 863s self = 863s consolidated = True, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_empty[3-False-False] ______________ 863s 863s self = 863s consolidated = False, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_empty[3-False-None] _______________ 863s 863s self = 863s consolidated = None, write_empty = False 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_write_empty[3-None-True] _______________ 863s 863s self = 863s consolidated = True, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrWriteEmpty.test_write_empty[3-None-False] _______________ 863s 863s self = 863s consolidated = False, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _______________ TestZarrWriteEmpty.test_write_empty[3-None-None] _______________ 863s 863s self = 863s consolidated = None, write_empty = None 863s 863s @pytest.mark.parametrize("consolidated", [True, False, None]) 863s @pytest.mark.parametrize("write_empty", [True, False, None]) 863s def test_write_empty( 863s self, 863s consolidated: bool | None, 863s write_empty: bool | None, 863s ) -> None: 863s def assert_expected_files(expected: list[str], store: str) -> None: 863s """Convenience for comparing with actual files written""" 863s ls = [] 863s test_root = os.path.join(store, "test") 863s for root, _, files in os.walk(test_root): 863s ls.extend( 863s [ 863s os.path.join(root, f).removeprefix(test_root).lstrip("/") 863s for f in files 863s ] 863s ) 863s 863s assert set(expected) == set( 863s [ 863s file.lstrip("c/") 863s for file in ls 863s if (file not in (".zattrs", ".zarray", "zarr.json")) 863s ] 863s ) 863s 863s # The zarr format is set by the `default_zarr_format` 863s # pytest fixture that acts on a superclass 863s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 863s if (write_empty is False) or (write_empty is None and has_zarr_v3): 863s expected = ["0.1.0"] 863s else: 863s expected = [ 863s "0.0.0", 863s "0.0.1", 863s "0.1.0", 863s "0.1.1", 863s ] 863s 863s if zarr_format_3: 863s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 863s # transform to the path style of zarr 3 863s # e.g. 0/0/1 863s expected = [e.replace(".", "/") for e in expected] 863s else: 863s # use nan for default fill_value behaviour 863s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 863s 863s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 863s 863s if has_dask: 863s ds["test"] = ds["test"].chunk(1) 863s encoding = None 863s else: 863s encoding = {"test": {"chunks": (1, 1, 1)}} 863s 863s with self.temp_dir() as (d, store): 863s ds.to_zarr( 863s store, 863s mode="w", 863s encoding=encoding, 863s write_empty_chunks=write_empty, 863s ) 863s 863s # check expected files after a write 863s assert_expected_files(expected, store) 863s 863s > with self.roundtrip_dir( 863s ds, 863s store, 863s save_kwargs={ 863s "mode": "a", 863s "append_dim": "Z", 863s "write_empty_chunks": write_empty, 863s }, 863s ) as a_ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 863s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-full-auto] _____________ 863s 863s self = 863s region = 'auto' 863s 863s @pytest.mark.parametrize( 863s "region", 863s [ 863s pytest.param("auto", id="full-auto"), 863s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 863s ], 863s ) 863s def test_zarr_region_auto(self, region): 863s with self.create() as (target, ds): 863s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 863s > self.save(target, ds_region, region=region) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-mixed-auto] ____________ 863s 863s self = 863s region = {'x': slice(np.int64(2), np.int64(4), None), 'y': slice(6, 8, None)} 863s 863s @pytest.mark.parametrize( 863s "region", 863s [ 863s pytest.param("auto", id="full-auto"), 863s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 863s ], 863s ) 863s def test_zarr_region_auto(self, region): 863s with self.create() as (target, ds): 863s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 863s > self.save(target, ds_region, region=region) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ______________ TestZarrRegionAuto.test_zarr_region_index_write[3] ______________ 863s 863s self = 863s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_zarr_region_index_write_30') 863s 863s def test_zarr_region_index_write(self, tmp_path): 863s region: Mapping[str, slice] | Literal["auto"] 863s region_slice = dict(x=slice(2, 4), y=slice(6, 8)) 863s 863s with self.create() as (target, ds): 863s ds_region = 1 + ds.isel(region_slice) 863s for region in [region_slice, "auto"]: # type: ignore[assignment] 863s with patch.object( 863s ZarrStore, 863s "set_variables", 863s side_effect=ZarrStore.set_variables, 863s autospec=True, 863s ) as mock: 863s > self.save(target, ds_region, region=region, mode="r+") 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6336: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ____________________ TestZarrRegionAuto.test_zarr_region[3] ____________________ 863s 863s self = 863s 863s def test_zarr_region(self): 863s with self.create() as (target, ds): 863s ds_transposed = ds.transpose("y", "x") 863s ds_region = 1 + ds_transposed.isel(x=[0], y=[0]) 863s > self.save(target, ds_region, region={"x": slice(0, 1), "y": slice(0, 1)}) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6369: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'test' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____________ TestZarrRegionAuto.test_zarr_append_chunk_partial[3] _____________ 863s 863s self = 863s 863s @requires_dask 863s def test_zarr_append_chunk_partial(self): 863s t_coords = np.array([np.datetime64("2020-01-01").astype("datetime64[ns]")]) 863s data = np.ones((10, 10)) 863s 863s da = xr.DataArray( 863s data.reshape((-1, 10, 10)), 863s dims=["time", "x", "y"], 863s coords={"time": t_coords}, 863s name="foo", 863s ) 863s new_time = np.array([np.datetime64("2021-01-01").astype("datetime64[ns]")]) 863s da2 = xr.DataArray( 863s data.reshape((-1, 10, 10)), 863s dims=["time", "x", "y"], 863s coords={"time": new_time}, 863s name="foo", 863s ) 863s 863s with self.create_zarr_target() as target: 863s self.save(target, da, mode="w", encoding={"foo": {"chunks": (5, 5, 1)}}) 863s 863s with pytest.raises(ValueError, match="encoding was provided"): 863s self.save( 863s target, 863s da2, 863s append_dim="time", 863s mode="a", 863s encoding={"foo": {"chunks": (1, 1, 1)}}, 863s ) 863s 863s # chunking with dask sidesteps the encoding check, so we need a different check 863s with pytest.raises(ValueError, match="Specified zarr chunks"): 863s > self.save( 863s target, 863s da2.chunk({"x": 1, "y": 1, "time": 1}), 863s append_dim="time", 863s mode="a", 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6426: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'foo' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _________ TestZarrRegionAuto.test_zarr_region_chunk_partial_offset[3] __________ 863s 863s self = 863s 863s @requires_dask 863s def test_zarr_region_chunk_partial_offset(self): 863s # https://github.com/pydata/xarray/pull/8459#issuecomment-1819417545 863s with self.create_zarr_target() as store: 863s data = np.ones((30,)) 863s da = xr.DataArray( 863s data, dims=["x"], coords={"x": range(30)}, name="foo" 863s ).chunk(x=10) 863s self.save(store, da, compute=False) 863s 863s > self.save(store, da.isel(x=slice(10)).chunk(x=(10,)), region="auto") 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6443: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'foo' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s ____________ TestZarrRegionAuto.test_zarr_safe_chunk_append_dim[3] _____________ 863s 863s self = 863s 863s @requires_dask 863s def test_zarr_safe_chunk_append_dim(self): 863s with self.create_zarr_target() as store: 863s data = np.ones((20,)) 863s da = xr.DataArray( 863s data, dims=["x"], coords={"x": range(20)}, name="foo" 863s ).chunk(x=5) 863s 863s self.save(store, da.isel(x=slice(0, 7)), safe_chunks=True, mode="w") 863s with pytest.raises(ValueError): 863s # If the first chunk is smaller than the border size then raise an error 863s > self.save( 863s store, 863s da.isel(x=slice(7, 11)).chunk(x=(2, 2)), 863s append_dim="x", 863s safe_chunks=True, 863s ) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6468: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = , name = 'foo' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-r+] _____________ 863s 863s self = 863s mode = 'r+' 863s 863s @requires_dask 863s @pytest.mark.parametrize("mode", ["r+", "a"]) 863s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 863s with self.create_zarr_target() as store: 863s arr = xr.DataArray( 863s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 863s ).chunk(a=3) 863s self.save(store, arr, mode="w") 863s 863s with pytest.raises(ValueError): 863s # There are two Dask chunks on the same Zarr chunk, 863s # which means that it is unsafe in any mode 863s self.save( 863s store, 863s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 863s region="auto", 863s mode=mode, 863s ) 863s 863s with pytest.raises(ValueError): 863s # the first chunk is covering the border size, but it is not 863s # completely covering the second chunk, which means that it is 863s # unsafe in any mode 863s self.save( 863s store, 863s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 863s region="auto", 863s mode=mode, 863s ) 863s 863s with pytest.raises(ValueError): 863s # The first chunk is safe but the other two chunks are overlapping with 863s # the same Zarr chunk 863s self.save( 863s store, 863s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 863s region="auto", 863s mode=mode, 863s ) 863s 863s # Fully update two contiguous chunks is safe in any mode 863s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 863s 863s # The last chunk is considered full based on their current size (2) 863s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 863s self.save( 863s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 863s ) 863s 863s # Write the last chunk of a region partially is safe in "a" mode 863s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 863s with pytest.raises(ValueError): 863s # with "r+" mode it is invalid to write partial chunk 863s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 863s 863s # This is safe with mode "a", the border size is covered by the first chunk of Dask 863s self.save( 863s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 863s ) 863s with pytest.raises(ValueError): 863s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 863s self.save( 863s store, 863s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s # This is safe on mode "a" because there is a single dask chunk 863s self.save( 863s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 863s ) 863s with pytest.raises(ValueError): 863s # This is unsafe on mode "r+", because the Dask chunk is partially writing 863s # in the first chunk of Zarr 863s self.save( 863s store, 863s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s # The first chunk is completely covering the first Zarr chunk 863s # and the last chunk is a partial one 863s self.save( 863s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 863s ) 863s 863s with pytest.raises(ValueError): 863s # The last chunk is partial, so it is considered unsafe on mode "r+" 863s self.save( 863s store, 863s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s # The first chunk is covering the border size (2 elements) 863s # and also the second chunk (3 elements), so it is valid 863s self.save( 863s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 863s ) 863s 863s with pytest.raises(ValueError): 863s # The first chunk is not fully covering the first zarr chunk 863s self.save( 863s store, 863s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s with pytest.raises(ValueError): 863s # Validate that the border condition is not affecting the "r+" mode 863s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 863s 863s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 863s with pytest.raises(ValueError): 863s # Validate that even if we write with a single Dask chunk on the last Zarr 863s # chunk it is still unsafe if it is not fully covering it 863s # (the last Zarr chunk has size 2) 863s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 863s 863s # Validate the same as the above test but in the beginning of the last chunk 863s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 863s with pytest.raises(ValueError): 863s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 863s 863s self.save( 863s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 863s ) 863s with pytest.raises(ValueError): 863s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 863s # if it is partial covering other Zarr chunks 863s self.save( 863s store, 863s arr.isel(a=slice(7, None)).chunk(a=-1), 863s region="auto", 863s mode="r+", 863s ) 863s 863s with pytest.raises(ValueError): 863s # If the chunk is of size equal to the one in the Zarr encoding, but 863s # it is partially writing in the first chunk then raise an error 863s self.save( 863s store, 863s arr.isel(a=slice(8, None)).chunk(a=3), 863s region="auto", 863s mode="r+", 863s ) 863s 863s with pytest.raises(ValueError): 863s self.save( 863s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 863s ) 863s 863s # Test if the code is detecting the last chunk correctly 863s data = np.random.default_rng(0).random((2920, 25, 53)) 863s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 863s chunks = {"time": 1000, "lat": 25, "lon": 53} 863s self.save(store, ds.chunk(chunks), compute=False, mode="w") 863s region = {"time": slice(1000, 2000, 1)} 863s chunk = ds.isel(region) 863s chunk = chunk.chunk() 863s > self.save(store, chunk.chunk(), region=region) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = 863s name = 'temperature' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-a] ______________ 863s 863s self = 863s mode = 'a' 863s 863s @requires_dask 863s @pytest.mark.parametrize("mode", ["r+", "a"]) 863s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 863s with self.create_zarr_target() as store: 863s arr = xr.DataArray( 863s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 863s ).chunk(a=3) 863s self.save(store, arr, mode="w") 863s 863s with pytest.raises(ValueError): 863s # There are two Dask chunks on the same Zarr chunk, 863s # which means that it is unsafe in any mode 863s self.save( 863s store, 863s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 863s region="auto", 863s mode=mode, 863s ) 863s 863s with pytest.raises(ValueError): 863s # the first chunk is covering the border size, but it is not 863s # completely covering the second chunk, which means that it is 863s # unsafe in any mode 863s self.save( 863s store, 863s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 863s region="auto", 863s mode=mode, 863s ) 863s 863s with pytest.raises(ValueError): 863s # The first chunk is safe but the other two chunks are overlapping with 863s # the same Zarr chunk 863s self.save( 863s store, 863s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 863s region="auto", 863s mode=mode, 863s ) 863s 863s # Fully update two contiguous chunks is safe in any mode 863s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 863s 863s # The last chunk is considered full based on their current size (2) 863s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 863s self.save( 863s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 863s ) 863s 863s # Write the last chunk of a region partially is safe in "a" mode 863s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 863s with pytest.raises(ValueError): 863s # with "r+" mode it is invalid to write partial chunk 863s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 863s 863s # This is safe with mode "a", the border size is covered by the first chunk of Dask 863s self.save( 863s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 863s ) 863s with pytest.raises(ValueError): 863s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 863s self.save( 863s store, 863s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s # This is safe on mode "a" because there is a single dask chunk 863s self.save( 863s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 863s ) 863s with pytest.raises(ValueError): 863s # This is unsafe on mode "r+", because the Dask chunk is partially writing 863s # in the first chunk of Zarr 863s self.save( 863s store, 863s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s # The first chunk is completely covering the first Zarr chunk 863s # and the last chunk is a partial one 863s self.save( 863s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 863s ) 863s 863s with pytest.raises(ValueError): 863s # The last chunk is partial, so it is considered unsafe on mode "r+" 863s self.save( 863s store, 863s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s # The first chunk is covering the border size (2 elements) 863s # and also the second chunk (3 elements), so it is valid 863s self.save( 863s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 863s ) 863s 863s with pytest.raises(ValueError): 863s # The first chunk is not fully covering the first zarr chunk 863s self.save( 863s store, 863s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 863s region="auto", 863s mode="r+", 863s ) 863s 863s with pytest.raises(ValueError): 863s # Validate that the border condition is not affecting the "r+" mode 863s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 863s 863s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 863s with pytest.raises(ValueError): 863s # Validate that even if we write with a single Dask chunk on the last Zarr 863s # chunk it is still unsafe if it is not fully covering it 863s # (the last Zarr chunk has size 2) 863s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 863s 863s # Validate the same as the above test but in the beginning of the last chunk 863s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 863s with pytest.raises(ValueError): 863s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 863s 863s self.save( 863s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 863s ) 863s with pytest.raises(ValueError): 863s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 863s # if it is partial covering other Zarr chunks 863s self.save( 863s store, 863s arr.isel(a=slice(7, None)).chunk(a=-1), 863s region="auto", 863s mode="r+", 863s ) 863s 863s with pytest.raises(ValueError): 863s # If the chunk is of size equal to the one in the Zarr encoding, but 863s # it is partially writing in the first chunk then raise an error 863s self.save( 863s store, 863s arr.isel(a=slice(8, None)).chunk(a=3), 863s region="auto", 863s mode="r+", 863s ) 863s 863s with pytest.raises(ValueError): 863s self.save( 863s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 863s ) 863s 863s # Test if the code is detecting the last chunk correctly 863s data = np.random.default_rng(0).random((2920, 25, 53)) 863s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 863s chunks = {"time": 1000, "lat": 25, "lon": 53} 863s self.save(store, ds.chunk(chunks), compute=False, mode="w") 863s region = {"time": slice(1000, 2000, 1)} 863s chunk = ds.isel(region) 863s chunk = chunk.chunk() 863s > self.save(store, chunk.chunk(), region=region) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 863s ds.to_zarr(target, **kwargs) 863s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 863s return to_zarr( # type: ignore[call-overload,misc] 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 863s dump_to_store(dataset, zstore, writer, encoding=encoding) 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 863s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 863s k: self.open_store_variable(name=k) for k in existing_variable_names 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s self = 863s name = 'temperature' 863s 863s def open_store_variable(self, name): 863s zarr_array = self.members[name] 863s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 863s try_nczarr = self._mode == "r" 863s dimensions, attributes = _get_zarr_dims_and_attrs( 863s zarr_array, DIMENSION_KEY, try_nczarr 863s ) 863s attributes = dict(attributes) 863s 863s encoding = { 863s "chunks": zarr_array.chunks, 863s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 863s } 863s 863s if _zarr_v3(): 863s encoding.update( 863s { 863s "compressors": zarr_array.compressors, 863s "filters": zarr_array.filters, 863s "shards": zarr_array.shards, 863s } 863s ) 863s if self.zarr_group.metadata.zarr_format == 3: 863s encoding.update({"serializer": zarr_array.serializer}) 863s else: 863s encoding.update( 863s { 863s "compressor": zarr_array.compressor, 863s "filters": zarr_array.filters, 863s } 863s ) 863s 863s if self._use_zarr_fill_value_as_mask: 863s # Setting this attribute triggers CF decoding for missing values 863s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 863s if zarr_array.fill_value is not None: 863s attributes["_FillValue"] = zarr_array.fill_value 863s elif "_FillValue" in attributes: 863s original_zarr_dtype = zarr_array.metadata.data_type 863s attributes["_FillValue"] = FillValueCoder.decode( 863s > attributes["_FillValue"], original_zarr_dtype.value 863s ) 863s E AttributeError: 'Float64' object has no attribute 'value' 863s 863s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 863s _____________ TestScipyFilePath.test_roundtrip_example_1_netcdf_gz _____________ 863s 863s self = 863s 863s def test_roundtrip_example_1_netcdf_gz(self) -> None: 863s with open_example_dataset("example_1.nc.gz") as expected: 863s > with open_example_dataset("example_1.nc") as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3940: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:164: in open_example_dataset 863s return open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _____________ TestGenericNetCDFData.test_zero_dimensional_variable _____________ 863s 863s self = 863s 863s def test_zero_dimensional_variable(self) -> None: 863s expected = create_test_data() 863s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 863s expected["bytes_var"] = ([], b"foobar") 863s expected["string_var"] = ([], "foobar") 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ________________ TestGenericNetCDFData.test_roundtrip_test_data ________________ 863s 863s self = 863s 863s def test_roundtrip_test_data(self) -> None: 863s expected = create_test_data() 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _______________________ TestGenericNetCDFData.test_load ________________________ 863s 863s self = 863s 863s def test_load(self) -> None: 863s expected = create_test_data() 863s 863s @contextlib.contextmanager 863s def assert_loads(vars=None): 863s if vars is None: 863s vars = expected 863s with self.roundtrip(expected) as actual: 863s for k, v in actual.variables.items(): 863s # IndexVariables are eagerly loaded into memory 863s assert v._in_memory == (k in actual.dims) 863s yield actual 863s for k, v in actual.variables.items(): 863s if k in vars: 863s assert v._in_memory 863s assert_identical(expected, actual) 863s 863s with pytest.raises(AssertionError): 863s # make sure the contextmanager works! 863s > with assert_loads() as ds: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 863s with self.roundtrip(expected) as actual: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s __________________ TestGenericNetCDFData.test_dataset_compute __________________ 863s 863s self = 863s 863s def test_dataset_compute(self) -> None: 863s expected = create_test_data() 863s 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________________ TestGenericNetCDFData.test_pickle _______________________ 863s 863s self = 863s 863s def test_pickle(self) -> None: 863s expected = Dataset({"foo": ("x", [42])}) 863s > with self.roundtrip(expected, allow_cleanup_failure=ON_WINDOWS) as roundtripped: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:499: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _________________ TestGenericNetCDFData.test_pickle_dataarray __________________ 863s 863s self = 863s 863s @pytest.mark.filterwarnings("ignore:deallocating CachingFileManager") 863s def test_pickle_dataarray(self) -> None: 863s expected = Dataset({"foo": ("x", [42])}) 863s > with self.roundtrip(expected, allow_cleanup_failure=ON_WINDOWS) as roundtripped: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:509: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s __________________ TestGenericNetCDFData.test_dataset_caching __________________ 863s 863s self = 863s 863s def test_dataset_caching(self) -> None: 863s expected = Dataset({"foo": ("x", [5, 6, 7])}) 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:519: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________ TestGenericNetCDFData.test_roundtrip_None_variable ______________ 863s 863s self = 863s 863s @pytest.mark.filterwarnings("ignore:deallocating CachingFileManager") 863s def test_roundtrip_None_variable(self) -> None: 863s expected = Dataset({None: (("x", "y"), [[0, 1], [2, 3]])}) 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:534: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________ TestGenericNetCDFData.test_roundtrip_object_dtype _______________ 863s 863s self = 863s 863s def test_roundtrip_object_dtype(self) -> None: 863s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 863s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 863s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 863s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 863s strings = np.array(["ab", "cdef", "g"], dtype=object) 863s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 863s all_nans = np.array([np.nan, np.nan], dtype=object) 863s original = Dataset( 863s { 863s "floats": ("a", floats), 863s "floats_nans": ("a", floats_nans), 863s "bytes": ("b", bytes_), 863s "bytes_nans": ("b", bytes_nans), 863s "strings": ("b", strings), 863s "strings_nans": ("b", strings_nans), 863s "all_nans": ("c", all_nans), 863s "nan": ([], np.nan), 863s } 863s ) 863s expected = original.copy(deep=True) 863s > with self.roundtrip(original) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _______________ TestGenericNetCDFData.test_roundtrip_string_data _______________ 863s 863s self = 863s 863s def test_roundtrip_string_data(self) -> None: 863s expected = Dataset({"x": ("t", ["ab", "cdef"])}) 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:575: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ________ TestGenericNetCDFData.test_roundtrip_string_encoded_characters ________ 863s 863s self = 863s 863s def test_roundtrip_string_encoded_characters(self) -> None: 863s expected = Dataset({"x": ("t", ["ab", "cdef"])}) 863s expected["x"].encoding["dtype"] = "S1" 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:581: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ___________ TestGenericNetCDFData.test_roundtrip_numpy_datetime_data ___________ 863s 863s self = 863s 863s def test_roundtrip_numpy_datetime_data(self) -> None: 863s times = pd.to_datetime(["2000-01-01", "2000-01-02", "NaT"], unit="ns") 863s expected = Dataset({"t": ("t", times), "t0": times[0]}) 863s kwargs = {"encoding": {"t0": {"units": "days since 1950-01-01"}}} 863s > with self.roundtrip(expected, save_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:594: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s __________ TestGenericNetCDFData.test_roundtrip_cftime_datetime_data ___________ 863s 863s self = 863s 863s @requires_cftime 863s def test_roundtrip_cftime_datetime_data(self) -> None: 863s from xarray.tests.test_coding_times import _all_cftime_date_types 863s 863s date_types = _all_cftime_date_types() 863s for date_type in date_types.values(): 863s times = [date_type(1, 1, 1), date_type(1, 1, 2)] 863s expected = Dataset({"t": ("t", times), "t0": times[0]}) 863s kwargs = {"encoding": {"t0": {"units": "days since 0001-01-01"}}} 863s expected_decoded_t = np.array(times) 863s expected_decoded_t0 = np.array([date_type(1, 1, 1)]) 863s expected_calendar = times[0].calendar 863s 863s with warnings.catch_warnings(): 863s if expected_calendar in {"proleptic_gregorian", "standard"}: 863s warnings.filterwarnings("ignore", "Unable to decode time axis") 863s 863s > with self.roundtrip(expected, save_kwargs=kwargs) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:615: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _____________ TestGenericNetCDFData.test_roundtrip_timedelta_data ______________ 863s 863s self = 863s 863s def test_roundtrip_timedelta_data(self) -> None: 863s # todo: suggestion from review: 863s # roundtrip large microsecond or coarser resolution timedeltas, 863s # though we cannot test that until we fix the timedelta decoding 863s # to support large ranges 863s time_deltas = pd.to_timedelta(["1h", "2h", "NaT"]).as_unit("s") # type: ignore[arg-type, unused-ignore] 863s expected = Dataset({"td": ("td", time_deltas), "td0": time_deltas[0]}) 863s > with self.roundtrip( 863s expected, open_kwargs={"decode_timedelta": CFTimedeltaCoder(time_unit="ns")} 863s ) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:639: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________ TestGenericNetCDFData.test_roundtrip_float64_data _______________ 863s 863s self = 863s 863s def test_roundtrip_float64_data(self) -> None: 863s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 863s > with self.roundtrip(expected) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _______________ TestGenericNetCDFData.test_roundtrip_coordinates _______________ 863s 863s self = 863s 863s def test_roundtrip_coordinates(self) -> None: 863s original = Dataset( 863s {"foo": ("x", [0, 1])}, {"x": [2, 3], "y": ("a", [42]), "z": ("x", [4, 5])} 863s ) 863s 863s > with self.roundtrip(original) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:664: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ___________ TestGenericNetCDFData.test_roundtrip_global_coordinates ____________ 863s 863s self = 863s 863s def test_roundtrip_global_coordinates(self) -> None: 863s original = Dataset( 863s {"foo": ("x", [0, 1])}, {"x": [2, 3], "y": ("a", [42]), "z": ("x", [4, 5])} 863s ) 863s > with self.roundtrip(original) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:679: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _________ TestGenericNetCDFData.test_roundtrip_coordinates_with_space __________ 863s 863s self = 863s 863s def test_roundtrip_coordinates_with_space(self) -> None: 863s original = Dataset(coords={"x": 0, "y z": 1}) 863s expected = Dataset({"y z": 1}, {"x": 0}) 863s with pytest.warns(SerializationWarning): 863s > with self.roundtrip(original) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:696: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________ TestGenericNetCDFData.test_roundtrip_boolean_dtype ______________ 863s 863s self = 863s 863s def test_roundtrip_boolean_dtype(self) -> None: 863s original = create_boolean_data() 863s assert original["x"].dtype == "bool" 863s > with self.roundtrip(original) as actual: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:702: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ________________ TestGenericNetCDFData.test_orthogonal_indexing ________________ 863s 863s self = 863s 863s def test_orthogonal_indexing(self) -> None: 863s in_memory = create_test_data() 863s > with self.roundtrip(in_memory) as on_disk: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ________________ TestGenericNetCDFData.test_vectorized_indexing ________________ 863s 863s self = 863s 863s def test_vectorized_indexing(self) -> None: 863s in_memory = create_test_data() 863s > with self.roundtrip(in_memory) as on_disk: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _________ TestGenericNetCDFData.test_vectorized_indexing_negative_step _________ 863s 863s self = 863s 863s def test_vectorized_indexing_negative_step(self) -> None: 863s # use dask explicitly when present 863s open_kwargs: dict[str, Any] | None 863s if has_dask: 863s open_kwargs = {"chunks": {}} 863s else: 863s open_kwargs = None 863s in_memory = create_test_data() 863s 863s def multiple_indexing(indexers): 863s # make sure a sequence of lazy indexings certainly works. 863s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 863s actual = on_disk["var3"] 863s expected = in_memory["var3"] 863s for ind in indexers: 863s actual = actual.isel(ind) 863s expected = expected.isel(ind) 863s # make sure the array is not yet loaded into memory 863s assert not actual.variable._in_memory 863s assert_identical(expected, actual.load()) 863s 863s # with negative step slice. 863s indexers = [ 863s { 863s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 863s "dim3": slice(-1, 1, -1), 863s } 863s ] 863s > multiple_indexing(indexers) 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 863s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________ TestGenericNetCDFData.test_outer_indexing_reversed ______________ 863s 863s self = 863s 863s def test_outer_indexing_reversed(self) -> None: 863s # regression test for GH6560 863s ds = xr.Dataset( 863s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 863s ) 863s 863s > with self.roundtrip(ds) as on_disk: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s __________________ TestGenericNetCDFData.test_isel_dataarray ___________________ 863s 863s self = 863s 863s def test_isel_dataarray(self) -> None: 863s # Make sure isel works lazily. GH:issue:1688 863s in_memory = create_test_data() 863s > with self.roundtrip(in_memory) as on_disk: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s _____________ TestGenericNetCDFData.test_array_type_after_indexing _____________ 863s 863s self = 863s 863s def test_array_type_after_indexing(self) -> None: 863s in_memory = create_test_data() 863s > with self.roundtrip(in_memory) as on_disk: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 863s with self.open(path, **open_kwargs) as ds: 863s /usr/lib/python3.14/contextlib.py:141: in __enter__ 863s return next(self.gen) 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 863s with open_dataset(path, engine=self.engine, **kwargs) as ds: 863s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 863s backend_ds = backend.open_dataset( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 863s store = NetCDF4DataStore.open( 863s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 863s import netCDF4 863s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 863s 863s # init for netCDF4. package 863s # Docstring comes from extension module _netCDF4. 863s > from ._netCDF4 import * 863s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 863s 863s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 863s ______________________ TestGenericNetCDFData.test_dropna _______________________ 863s 863s self = 863s 863s def test_dropna(self) -> None: 863s # regression test for GH:issue:1694 863s a = np.random.randn(4, 3) 863s a[1, 1] = np.nan 863s in_memory = xr.Dataset( 863s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 863s ) 863s 863s assert_identical( 863s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 863s ) 863s 863s > with self.roundtrip(in_memory) as on_disk: 863s 863s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________________ TestGenericNetCDFData.test_ondisk_after_print _________________ 864s 864s self = 864s 864s def test_ondisk_after_print(self) -> None: 864s """Make sure print does not load file into memory""" 864s in_memory = create_test_data() 864s > with self.roundtrip(in_memory) as on_disk: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s __________ TestGenericNetCDFData.test_roundtrip_bytes_with_fill_value __________ 864s 864s self = 864s 864s def test_roundtrip_bytes_with_fill_value(self) -> None: 864s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 864s encoding = {"_FillValue": b"X", "dtype": "S1"} 864s original = Dataset({"x": ("t", values, {}, encoding)}) 864s expected = original.copy(deep=True) 864s > with self.roundtrip(original) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _________ TestGenericNetCDFData.test_roundtrip_empty_vlen_string_array _________ 864s 864s self = 864s 864s def test_roundtrip_empty_vlen_string_array(self) -> None: 864s # checks preserving vlen dtype for empty arrays GH7862 864s dtype = create_vlen_dtype(str) 864s original = Dataset({"a": np.array([], dtype=dtype)}) 864s assert check_vlen_dtype(original["a"].dtype) is str 864s > with self.roundtrip(original) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:936: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______ TestGenericNetCDFData.test_roundtrip_unsigned[fill_value0-False] _______ 864s 864s self = 864s fill_value = np.int8(-1), exp_fill_warning = False 864s 864s @pytest.mark.parametrize( 864s ("fill_value", "exp_fill_warning"), 864s [ 864s (np.int8(-1), False), 864s (np.uint8(255), True), 864s (-1, False), 864s (255, True), 864s ], 864s ) 864s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 864s @contextlib.contextmanager 864s def _roundtrip_with_warnings(*args, **kwargs): 864s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 864s if exp_fill_warning and is_np2: 864s warn_checker: contextlib.AbstractContextManager = pytest.warns( 864s SerializationWarning, 864s match="_FillValue attribute can't be represented", 864s ) 864s else: 864s warn_checker = contextlib.nullcontext() 864s with warn_checker: 864s with self.roundtrip(*args, **kwargs) as actual: 864s yield actual 864s 864s # regression/numpy2 test for 864s encoding = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s "dtype": "i1", 864s } 864s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 864s decoded = Dataset({"x": ("t", x, {}, encoding)}) 864s 864s attributes = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s } 864s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 864s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 864s encoded = Dataset({"x": ("t", sb, attributes)}) 864s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 864s 864s > with _roundtrip_with_warnings(decoded) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 864s with self.roundtrip(*args, **kwargs) as actual: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______ TestGenericNetCDFData.test_roundtrip_unsigned[fill_value1-True] ________ 864s 864s self = 864s fill_value = np.uint8(255), exp_fill_warning = True 864s 864s @pytest.mark.parametrize( 864s ("fill_value", "exp_fill_warning"), 864s [ 864s (np.int8(-1), False), 864s (np.uint8(255), True), 864s (-1, False), 864s (255, True), 864s ], 864s ) 864s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 864s @contextlib.contextmanager 864s def _roundtrip_with_warnings(*args, **kwargs): 864s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 864s if exp_fill_warning and is_np2: 864s warn_checker: contextlib.AbstractContextManager = pytest.warns( 864s SerializationWarning, 864s match="_FillValue attribute can't be represented", 864s ) 864s else: 864s warn_checker = contextlib.nullcontext() 864s with warn_checker: 864s with self.roundtrip(*args, **kwargs) as actual: 864s yield actual 864s 864s # regression/numpy2 test for 864s encoding = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s "dtype": "i1", 864s } 864s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 864s decoded = Dataset({"x": ("t", x, {}, encoding)}) 864s 864s attributes = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s } 864s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 864s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 864s encoded = Dataset({"x": ("t", sb, attributes)}) 864s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 864s 864s > with _roundtrip_with_warnings(decoded) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 864s with self.roundtrip(*args, **kwargs) as actual: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ TestGenericNetCDFData.test_roundtrip_unsigned[-1-False] ____________ 864s 864s self = 864s fill_value = -1, exp_fill_warning = False 864s 864s @pytest.mark.parametrize( 864s ("fill_value", "exp_fill_warning"), 864s [ 864s (np.int8(-1), False), 864s (np.uint8(255), True), 864s (-1, False), 864s (255, True), 864s ], 864s ) 864s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 864s @contextlib.contextmanager 864s def _roundtrip_with_warnings(*args, **kwargs): 864s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 864s if exp_fill_warning and is_np2: 864s warn_checker: contextlib.AbstractContextManager = pytest.warns( 864s SerializationWarning, 864s match="_FillValue attribute can't be represented", 864s ) 864s else: 864s warn_checker = contextlib.nullcontext() 864s with warn_checker: 864s with self.roundtrip(*args, **kwargs) as actual: 864s yield actual 864s 864s # regression/numpy2 test for 864s encoding = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s "dtype": "i1", 864s } 864s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 864s decoded = Dataset({"x": ("t", x, {}, encoding)}) 864s 864s attributes = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s } 864s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 864s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 864s encoded = Dataset({"x": ("t", sb, attributes)}) 864s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 864s 864s > with _roundtrip_with_warnings(decoded) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 864s with self.roundtrip(*args, **kwargs) as actual: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ TestGenericNetCDFData.test_roundtrip_unsigned[255-True] ____________ 864s 864s self = 864s fill_value = 255, exp_fill_warning = True 864s 864s @pytest.mark.parametrize( 864s ("fill_value", "exp_fill_warning"), 864s [ 864s (np.int8(-1), False), 864s (np.uint8(255), True), 864s (-1, False), 864s (255, True), 864s ], 864s ) 864s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 864s @contextlib.contextmanager 864s def _roundtrip_with_warnings(*args, **kwargs): 864s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 864s if exp_fill_warning and is_np2: 864s warn_checker: contextlib.AbstractContextManager = pytest.warns( 864s SerializationWarning, 864s match="_FillValue attribute can't be represented", 864s ) 864s else: 864s warn_checker = contextlib.nullcontext() 864s with warn_checker: 864s with self.roundtrip(*args, **kwargs) as actual: 864s yield actual 864s 864s # regression/numpy2 test for 864s encoding = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s "dtype": "i1", 864s } 864s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 864s decoded = Dataset({"x": ("t", x, {}, encoding)}) 864s 864s attributes = { 864s "_FillValue": fill_value, 864s "_Unsigned": "true", 864s } 864s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 864s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 864s encoded = Dataset({"x": ("t", sb, attributes)}) 864s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 864s 864s > with _roundtrip_with_warnings(decoded) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 864s with self.roundtrip(*args, **kwargs) as actual: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestGenericNetCDFData.test_grid_mapping_and_bounds_are_not_coordinates_in_file _ 864s 864s self = 864s 864s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 864s original = self._create_cf_dataset() 864s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___ TestGenericNetCDFData.test_coordinate_variables_after_dataset_roundtrip ____ 864s 864s self = 864s 864s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 864s original = self._create_cf_dataset() 864s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestGenericNetCDFData.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip _ 864s 864s self = 864s 864s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 864s self, 864s ) -> None: 864s original = self._create_cf_dataset() 864s # The DataArray roundtrip should have the same warnings as the 864s # Dataset, but we already tested for those, so just go for the 864s # new warnings. It would appear that there is no way to tell 864s # pytest "This warning and also this warning should both be 864s # present". 864s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 864s # needs the to_dataset. The other backends should be fine 864s # without it. 864s with pytest.warns( 864s UserWarning, 864s match=( 864s r"Variable\(s\) referenced in bounds not in variables: " 864s r"\['l(at|ong)itude_bnds'\]" 864s ), 864s ): 864s > with self.roundtrip( 864s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s 864s During handling of the above exception, another exception occurred: 864s 864s self = 864s 864s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 864s self, 864s ) -> None: 864s original = self._create_cf_dataset() 864s # The DataArray roundtrip should have the same warnings as the 864s # Dataset, but we already tested for those, so just go for the 864s # new warnings. It would appear that there is no way to tell 864s # pytest "This warning and also this warning should both be 864s # present". 864s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 864s # needs the to_dataset. The other backends should be fine 864s # without it. 864s > with pytest.warns( 864s UserWarning, 864s match=( 864s r"Variable\(s\) referenced in bounds not in variables: " 864s r"\['l(at|ong)itude_bnds'\]" 864s ), 864s ): 864s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 864s E Emitted warnings: []. 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 864s _______________ TestGenericNetCDFData.test_coordinates_encoding ________________ 864s 864s self = 864s 864s def test_coordinates_encoding(self) -> None: 864s def equals_latlon(obj): 864s return obj == "lat lon" or obj == "lon lat" 864s 864s original = Dataset( 864s {"temp": ("x", [0, 1]), "precip": ("x", [0, -1])}, 864s {"lat": ("x", [2, 3]), "lon": ("x", [4, 5])}, 864s ) 864s > with self.roundtrip(original) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1207: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s __________________ TestGenericNetCDFData.test_encoding_kwarg ___________________ 864s 864s self = 864s 864s def test_encoding_kwarg(self) -> None: 864s ds = Dataset({"x": ("y", np.arange(10.0))}) 864s 864s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______________ TestGenericNetCDFData.test_encoding_kwarg_dates ________________ 864s 864s self = 864s 864s def test_encoding_kwarg_dates(self) -> None: 864s ds = Dataset({"t": pd.date_range("2000-01-01", periods=3)}) 864s units = "days since 1900-01-01" 864s kwargs = dict(encoding={"t": {"units": units}}) 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1302: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _________ TestGenericNetCDFData.test_encoding_kwarg_fixed_width_string _________ 864s 864s self = 864s 864s def test_encoding_kwarg_fixed_width_string(self) -> None: 864s # regression test for GH2149 864s for strings in [[b"foo", b"bar", b"baz"], ["foo", "bar", "baz"]]: 864s ds = Dataset({"x": strings}) 864s kwargs = dict(encoding={"x": {"dtype": "S1"}}) 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1311: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________________ TestGenericNetCDFData.test_default_fill_value _________________ 864s 864s self = 864s 864s def test_default_fill_value(self) -> None: 864s # Test default encoding for float: 864s ds = Dataset({"x": ("y", np.arange(10.0))}) 864s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ____________ TestGenericNetCDFData.test_explicitly_omit_fill_value _____________ 864s 864s self = 864s 864s def test_explicitly_omit_fill_value(self) -> None: 864s ds = Dataset({"x": ("y", [np.pi, -np.pi])}) 864s ds.x.encoding["_FillValue"] = None 864s > with self.roundtrip(ds) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1341: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___ TestGenericNetCDFData.test_explicitly_omit_fill_value_via_encoding_kwarg ___ 864s 864s self = 864s 864s def test_explicitly_omit_fill_value_via_encoding_kwarg(self) -> None: 864s ds = Dataset({"x": ("y", [np.pi, -np.pi])}) 864s kwargs = dict(encoding={"x": {"_FillValue": None}}) 864s # _FillValue is not a valid encoding for Zarr 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1348: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________ TestGenericNetCDFData.test_explicitly_omit_fill_value_in_coord ________ 864s 864s self = 864s 864s def test_explicitly_omit_fill_value_in_coord(self) -> None: 864s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 864s ds.y.encoding["_FillValue"] = None 864s > with self.roundtrip(ds) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestGenericNetCDFData.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg _ 864s 864s self = 864s 864s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 864s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 864s kwargs = dict(encoding={"y": {"_FillValue": None}}) 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________________ TestGenericNetCDFData.test_encoding_same_dtype ________________ 864s 864s self = 864s 864s def test_encoding_same_dtype(self) -> None: 864s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 864s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 864s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________________ TestGenericNetCDFData.test_append_write ____________________ 864s 864s self = 864s 864s def test_append_write(self) -> None: 864s # regression for GH1215 864s data = create_test_data() 864s > with self.roundtrip_append(data) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:389: in roundtrip_append 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________ TestGenericNetCDFData.test_append_overwrite_values ______________ 864s 864s self = 864s 864s def test_append_overwrite_values(self) -> None: 864s # regression for GH1215 864s data = create_test_data() 864s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 864s self.save(data, tmp_file, mode="w") 864s data["var2"][:] = -999 864s data["var9"] = data["var2"] * 3 864s self.save(data[["var2", "var9"]], tmp_file, mode="a") 864s > with self.open(tmp_file) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1388: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ____________ TestGenericNetCDFData.test_multiindex_not_implemented _____________ 864s 864s self = 864s 864s def test_multiindex_not_implemented(self) -> None: 864s ds = Dataset(coords={"y": ("x", [1, 2]), "z": ("x", ["a", "b"])}).set_index( 864s x=["y", "z"] 864s ) 864s with pytest.raises(NotImplementedError, match=r"MultiIndex"): 864s with self.roundtrip(ds): 864s pass 864s 864s # regression GH8628 (can serialize reset multi-index level coordinates) 864s ds_reset = ds.reset_index("x") 864s > with self.roundtrip(ds_reset) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1412: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______________ TestGenericNetCDFData.test_string_object_warning _______________ 864s 864s self = 864s 864s @requires_dask 864s def test_string_object_warning(self) -> None: 864s original = Dataset( 864s { 864s "x": ( 864s [ 864s "y", 864s ], 864s np.array(["foo", "bar"], dtype=object), 864s ) 864s } 864s ).chunk() 864s with pytest.warns(SerializationWarning, match="dask array with dtype=object"): 864s > with self.roundtrip(original) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1428: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________ TestGenericNetCDFData.test_encoding_unlimited_dims ______________ 864s 864s self = 864s 864s def test_encoding_unlimited_dims(self) -> None: 864s ds = Dataset({"x": ("y", np.arange(10.0))}) 864s > with self.roundtrip(ds, save_kwargs=dict(unlimited_dims=["y"])) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4046: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 864s with self.open(path, **open_kwargs) as ds: 864s /usr/lib/python3.14/contextlib.py:141: in __enter__ 864s return next(self.gen) 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 864s with open_dataset(path, engine=self.engine, **kwargs) as ds: 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-all-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'all', join = 'outer' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'outer' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'outer' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'outer' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-different-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'different', join = 'outer' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'outer' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-all-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'all', join = 'inner' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'inner' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'inner' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'inner' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-different-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'different', join = 'inner' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-different-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'inner' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-all-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'all', join = 'left' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-all-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'left' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-minimal-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'left' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-minimal-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'left' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-different-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'different', join = 'left' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-different-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'left' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-all-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'all', join = 'right' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-all-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'right' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-minimal-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'right' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-minimal-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'right' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-different-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'different', join = 'right' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-different-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'right' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 864s def test_open_mfdataset_does_same_as_concat( 864s self, combine, concat_dim, opt, join 864s ) -> None: 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s > with open_mfdataset( 864s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[drop] _ 864s 864s self = 864s combine_attrs = 'drop', attrs = [{'a': 1}, {'a': 2}], expected = {} 864s expect_error = False 864s 864s @pytest.mark.parametrize( 864s ["combine_attrs", "attrs", "expected", "expect_error"], 864s ( 864s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 864s pytest.param( 864s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 864s ), 864s pytest.param( 864s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 864s ), 864s pytest.param( 864s "identical", 864s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 864s None, 864s True, 864s id="identical", 864s ), 864s pytest.param( 864s "drop_conflicts", 864s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 864s {"a": 1, "c": 3}, 864s False, 864s id="drop_conflicts", 864s ), 864s ), 864s ) 864s def test_open_mfdataset_dataset_combine_attrs( 864s self, combine_attrs, attrs, expected, expect_error 864s ): 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[override] _ 864s 864s self = 864s combine_attrs = 'override', attrs = [{'a': 1}, {'a': 2}], expected = {'a': 1} 864s expect_error = False 864s 864s @pytest.mark.parametrize( 864s ["combine_attrs", "attrs", "expected", "expect_error"], 864s ( 864s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 864s pytest.param( 864s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 864s ), 864s pytest.param( 864s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 864s ), 864s pytest.param( 864s "identical", 864s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 864s None, 864s True, 864s id="identical", 864s ), 864s pytest.param( 864s "drop_conflicts", 864s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 864s {"a": 1, "c": 3}, 864s False, 864s id="drop_conflicts", 864s ), 864s ), 864s ) 864s def test_open_mfdataset_dataset_combine_attrs( 864s self, combine_attrs, attrs, expected, expect_error 864s ): 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[no_conflicts] _ 864s 864s self = 864s combine_attrs = 'no_conflicts', attrs = [{'a': 1}, {'a': 2}], expected = None 864s expect_error = True 864s 864s @pytest.mark.parametrize( 864s ["combine_attrs", "attrs", "expected", "expect_error"], 864s ( 864s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 864s pytest.param( 864s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 864s ), 864s pytest.param( 864s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 864s ), 864s pytest.param( 864s "identical", 864s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 864s None, 864s True, 864s id="identical", 864s ), 864s pytest.param( 864s "drop_conflicts", 864s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 864s {"a": 1, "c": 3}, 864s False, 864s id="drop_conflicts", 864s ), 864s ), 864s ) 864s def test_open_mfdataset_dataset_combine_attrs( 864s self, combine_attrs, attrs, expected, expect_error 864s ): 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[identical] _ 864s 864s self = 864s combine_attrs = 'identical', attrs = [{'a': 1, 'b': 2}, {'a': 1, 'c': 3}] 864s expected = None, expect_error = True 864s 864s @pytest.mark.parametrize( 864s ["combine_attrs", "attrs", "expected", "expect_error"], 864s ( 864s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 864s pytest.param( 864s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 864s ), 864s pytest.param( 864s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 864s ), 864s pytest.param( 864s "identical", 864s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 864s None, 864s True, 864s id="identical", 864s ), 864s pytest.param( 864s "drop_conflicts", 864s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 864s {"a": 1, "c": 3}, 864s False, 864s id="drop_conflicts", 864s ), 864s ), 864s ) 864s def test_open_mfdataset_dataset_combine_attrs( 864s self, combine_attrs, attrs, expected, expect_error 864s ): 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[drop_conflicts] _ 864s 864s self = 864s combine_attrs = 'drop_conflicts', attrs = [{'a': 1, 'b': 2}, {'b': -1, 'c': 3}] 864s expected = {'a': 1, 'c': 3}, expect_error = False 864s 864s @pytest.mark.parametrize( 864s ["combine_attrs", "attrs", "expected", "expect_error"], 864s ( 864s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 864s pytest.param( 864s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 864s ), 864s pytest.param( 864s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 864s ), 864s pytest.param( 864s "identical", 864s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 864s None, 864s True, 864s id="identical", 864s ), 864s pytest.param( 864s "drop_conflicts", 864s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 864s {"a": 1, "c": 3}, 864s False, 864s id="drop_conflicts", 864s ), 864s ), 864s ) 864s def test_open_mfdataset_dataset_combine_attrs( 864s self, combine_attrs, attrs, expected, expect_error 864s ): 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_attr_by_coords _ 864s 864s self = 864s 864s def test_open_mfdataset_dataset_attr_by_coords(self) -> None: 864s """ 864s Case when an attribute differs across the multiple files 864s """ 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4725: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataarray_attr_by_coords _ 864s 864s self = 864s 864s def test_open_mfdataset_dataarray_attr_by_coords(self) -> None: 864s """ 864s Case when an attribute of a member DataArray differs across the multiple files 864s """ 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # Give the files an inconsistent attribute 864s for i, f in enumerate(files): 864s > ds = open_dataset(f).load() 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4740: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[all-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'all' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s def test_open_mfdataset_exact_join_raises_error( 864s self, combine, concat_dim, opt 864s ) -> None: 864s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s with pytest.raises( 864s ValueError, match=r"cannot align objects.*join.*exact.*" 864s ): 864s > open_mfdataset( 864s files, 864s data_vars=opt, 864s combine=combine, 864s concat_dim=concat_dim, 864s join="exact", 864s ) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[all-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'all' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s def test_open_mfdataset_exact_join_raises_error( 864s self, combine, concat_dim, opt 864s ) -> None: 864s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s with pytest.raises( 864s ValueError, match=r"cannot align objects.*join.*exact.*" 864s ): 864s > open_mfdataset( 864s files, 864s data_vars=opt, 864s combine=combine, 864s concat_dim=concat_dim, 864s join="exact", 864s ) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[minimal-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'minimal' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s def test_open_mfdataset_exact_join_raises_error( 864s self, combine, concat_dim, opt 864s ) -> None: 864s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s with pytest.raises( 864s ValueError, match=r"cannot align objects.*join.*exact.*" 864s ): 864s > open_mfdataset( 864s files, 864s data_vars=opt, 864s combine=combine, 864s concat_dim=concat_dim, 864s join="exact", 864s ) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[minimal-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'minimal' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s def test_open_mfdataset_exact_join_raises_error( 864s self, combine, concat_dim, opt 864s ) -> None: 864s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s with pytest.raises( 864s ValueError, match=r"cannot align objects.*join.*exact.*" 864s ): 864s > open_mfdataset( 864s files, 864s data_vars=opt, 864s combine=combine, 864s concat_dim=concat_dim, 864s join="exact", 864s ) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[different-nested-t] _ 864s 864s self = 864s combine = 'nested', concat_dim = 't', opt = 'different' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s def test_open_mfdataset_exact_join_raises_error( 864s self, combine, concat_dim, opt 864s ) -> None: 864s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s with pytest.raises( 864s ValueError, match=r"cannot align objects.*join.*exact.*" 864s ): 864s > open_mfdataset( 864s files, 864s data_vars=opt, 864s combine=combine, 864s concat_dim=concat_dim, 864s join="exact", 864s ) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[different-by_coords-None] _ 864s 864s self = 864s combine = 'by_coords', concat_dim = None, opt = 'different' 864s 864s @pytest.mark.parametrize( 864s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 864s ) 864s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 864s def test_open_mfdataset_exact_join_raises_error( 864s self, combine, concat_dim, opt 864s ) -> None: 864s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 864s if combine == "by_coords": 864s files.reverse() 864s with pytest.raises( 864s ValueError, match=r"cannot align objects.*join.*exact.*" 864s ): 864s > open_mfdataset( 864s files, 864s data_vars=opt, 864s combine=combine, 864s concat_dim=concat_dim, 864s join="exact", 864s ) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_common_coord_when_datavars_all _ 864s 864s self = 864s 864s def test_common_coord_when_datavars_all(self) -> None: 864s opt: Final = "all" 864s 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # open the files with the data_var option 864s > with open_mfdataset( 864s files, data_vars=opt, combine="nested", concat_dim="t" 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4774: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_common_coord_when_datavars_minimal _ 864s 864s self = 864s 864s def test_common_coord_when_datavars_minimal(self) -> None: 864s opt: Final = "minimal" 864s 864s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 864s # open the files using data_vars option 864s > with open_mfdataset( 864s files, data_vars=opt, combine="nested", concat_dim="t" 864s ) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4792: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_invalid_data_vars_value_should_fail _ 864s 864s self = 864s 864s def test_invalid_data_vars_value_should_fail(self) -> None: 864s with self.setup_files_and_datasets() as (files, _): 864s with pytest.raises(ValueError): 864s > with open_mfdataset(files, data_vars="minimum", combine="by_coords"): # type: ignore[arg-type] 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4808: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 864s datasets = [open_(p, **open_kwargs) for p in paths1d] 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ____________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_no_name ____________ 864s 864s self = 864s 864s def test_dataarray_to_netcdf_no_name(self) -> None: 864s original_da = DataArray(np.arange(12).reshape((3, 4))) 864s 864s with create_tmp_file() as tmp: 864s original_da.to_netcdf(tmp) 864s 864s > with open_dataarray(tmp) as loaded_da: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5576: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 864s dataset = open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_with_name ___________ 864s 864s self = 864s 864s def test_dataarray_to_netcdf_with_name(self) -> None: 864s original_da = DataArray(np.arange(12).reshape((3, 4)), name="test") 864s 864s with create_tmp_file() as tmp: 864s original_da.to_netcdf(tmp) 864s 864s > with open_dataarray(tmp) as loaded_da: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5585: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 864s dataset = open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______ TestDataArrayToNetCDF.test_dataarray_to_netcdf_coord_name_clash ________ 864s 864s self = 864s 864s def test_dataarray_to_netcdf_coord_name_clash(self) -> None: 864s original_da = DataArray( 864s np.arange(12).reshape((3, 4)), dims=["x", "y"], name="x" 864s ) 864s 864s with create_tmp_file() as tmp: 864s original_da.to_netcdf(tmp) 864s 864s > with open_dataarray(tmp) as loaded_da: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5596: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 864s dataset = open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________ TestDataArrayToNetCDF.test_open_dataarray_options _______________ 864s 864s self = 864s 864s def test_open_dataarray_options(self) -> None: 864s data = DataArray(np.arange(5), coords={"y": ("x", range(5))}, dims=["x"]) 864s 864s with create_tmp_file() as tmp: 864s data.to_netcdf(tmp) 864s 864s expected = data.drop_vars("y") 864s > with open_dataarray(tmp, drop_variables=["y"]) as loaded: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5606: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 864s dataset = open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_no_name_pathlib ________ 864s 864s self = 864s 864s def test_dataarray_to_netcdf_no_name_pathlib(self) -> None: 864s original_da = DataArray(np.arange(12).reshape((3, 4))) 864s 864s with create_tmp_file() as tmps: 864s tmp = Path(tmps) 864s original_da.to_netcdf(tmp) 864s 864s > with open_dataarray(tmp) as loaded_da: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5623: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 864s dataset = open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_source_encoding_always_present ______________________ 864s 864s @requires_scipy_or_netCDF4 864s def test_source_encoding_always_present() -> None: 864s # Test for GH issue #2550. 864s rnddata = np.random.randn(10) 864s original = Dataset({"foo": ("x", rnddata)}) 864s with create_tmp_file() as tmp: 864s original.to_netcdf(tmp) 864s > with open_dataset(tmp) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5703: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______________ test_source_encoding_always_present_with_pathlib _______________ 864s 864s @requires_scipy_or_netCDF4 864s def test_source_encoding_always_present_with_pathlib() -> None: 864s # Test for GH issue #5888. 864s rnddata = np.random.randn(10) 864s original = Dataset({"foo": ("x", rnddata)}) 864s with create_tmp_file() as tmp: 864s original.to_netcdf(tmp) 864s > with open_dataset(Path(tmp)) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5714: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________ test_use_cftime_standard_calendar_default_in_range[gregorian] _________ 864s 864s calendar = 'gregorian' 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 864s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units_date = "2000-01-01" 864s units = "days since 2000-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s x_timedeltas = np.array(x).astype("timedelta64[D]") 864s time_timedeltas = np.array(time).astype("timedelta64[D]") 864s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 864s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s > with open_dataset(tmp_file) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___ test_use_cftime_standard_calendar_default_in_range[proleptic_gregorian] ____ 864s 864s calendar = 'proleptic_gregorian' 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 864s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units_date = "2000-01-01" 864s units = "days since 2000-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s x_timedeltas = np.array(x).astype("timedelta64[D]") 864s time_timedeltas = np.array(time).astype("timedelta64[D]") 864s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 864s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s > with open_dataset(tmp_file) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _________ test_use_cftime_standard_calendar_default_in_range[standard] _________ 864s 864s calendar = 'standard' 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 864s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units_date = "2000-01-01" 864s units = "days since 2000-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s x_timedeltas = np.array(x).astype("timedelta64[D]") 864s time_timedeltas = np.array(time).astype("timedelta64[D]") 864s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 864s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s > with open_dataset(tmp_file) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______ test_use_cftime_standard_calendar_default_out_of_range[standard] _______ 864s 864s calendar = 'standard' 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 864s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 864s # todo: check, if we still need to test for two dates 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = "days since 1582-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.warns(SerializationWarning): 864s > with open_dataset(tmp_file) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5794: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s 864s During handling of the above exception, another exception occurred: 864s 864s calendar = 'standard' 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 864s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 864s # todo: check, if we still need to test for two dates 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = "days since 1582-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s > with pytest.warns(SerializationWarning): 864s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 864s E Emitted warnings: []. 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5793: Failed 864s ______ test_use_cftime_standard_calendar_default_out_of_range[gregorian] _______ 864s 864s calendar = 'gregorian' 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 864s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 864s # todo: check, if we still need to test for two dates 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = "days since 1582-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.warns(SerializationWarning): 864s > with open_dataset(tmp_file) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5794: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s 864s During handling of the above exception, another exception occurred: 864s 864s calendar = 'gregorian' 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 864s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 864s # todo: check, if we still need to test for two dates 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = "days since 1582-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s > with pytest.warns(SerializationWarning): 864s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 864s E Emitted warnings: []. 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5793: Failed 864s ______________________ test_use_cftime_true[1500-360_day] ______________________ 864s 864s calendar = '360_day', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[1500-365_day] ______________________ 864s 864s calendar = '365_day', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[1500-366_day] ______________________ 864s 864s calendar = '366_day', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[1500-all_leap] ______________________ 864s 864s calendar = 'all_leap', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[1500-gregorian] _____________________ 864s 864s calendar = 'gregorian', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[1500-julian] _______________________ 864s 864s calendar = 'julian', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[1500-noleap] _______________________ 864s 864s calendar = 'noleap', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________________ test_use_cftime_true[1500-proleptic_gregorian] ________________ 864s 864s calendar = 'proleptic_gregorian', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[1500-standard] ______________________ 864s 864s calendar = 'standard', units_year = 1500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2000-360_day] ______________________ 864s 864s calendar = '360_day', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2000-365_day] ______________________ 864s 864s calendar = '365_day', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2000-366_day] ______________________ 864s 864s calendar = '366_day', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[2000-all_leap] ______________________ 864s 864s calendar = 'all_leap', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[2000-gregorian] _____________________ 864s 864s calendar = 'gregorian', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2000-julian] _______________________ 864s 864s calendar = 'julian', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2000-noleap] _______________________ 864s 864s calendar = 'noleap', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________________ test_use_cftime_true[2000-proleptic_gregorian] ________________ 864s 864s calendar = 'proleptic_gregorian', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[2000-standard] ______________________ 864s 864s calendar = 'standard', units_year = 2000 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2500-360_day] ______________________ 864s 864s calendar = '360_day', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2500-365_day] ______________________ 864s 864s calendar = '365_day', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2500-366_day] ______________________ 864s 864s calendar = '366_day', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[2500-all_leap] ______________________ 864s 864s calendar = 'all_leap', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[2500-gregorian] _____________________ 864s 864s calendar = 'gregorian', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2500-julian] _______________________ 864s 864s calendar = 'julian', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________ test_use_cftime_true[2500-noleap] _______________________ 864s 864s calendar = 'noleap', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________________ test_use_cftime_true[2500-proleptic_gregorian] ________________ 864s 864s calendar = 'proleptic_gregorian', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _____________________ test_use_cftime_true[2500-standard] ______________________ 864s 864s calendar = 'standard', units_year = 2500 864s 864s @requires_cftime 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_true(calendar, units_year) -> None: 864s import cftime 864s 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 864s decoded_time = cftime.num2date( 864s time, units, calendar, only_use_cftime_datetimes=True 864s ) 864s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 864s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with warnings.catch_warnings(record=True) as record: 864s decoder = CFDatetimeCoder(use_cftime=True) 864s > with open_dataset(tmp_file, decode_times=decoder) as ds: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ________ test_use_cftime_false_standard_calendar_out_of_range[standard] ________ 864s 864s calendar = 'standard' 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 864s def test_use_cftime_false_standard_calendar_out_of_range(calendar) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = "days since 1582-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5877: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s _______ test_use_cftime_false_standard_calendar_out_of_range[gregorian] ________ 864s 864s calendar = 'gregorian' 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 864s def test_use_cftime_false_standard_calendar_out_of_range(calendar) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = "days since 1582-01-01" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5877: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[1500-360_day] ___________ 864s 864s calendar = '360_day', units_year = 1500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[1500-365_day] ___________ 864s 864s calendar = '365_day', units_year = 1500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[1500-366_day] ___________ 864s 864s calendar = '366_day', units_year = 1500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s __________ test_use_cftime_false_nonstandard_calendar[1500-all_leap] ___________ 864s 864s calendar = 'all_leap', units_year = 1500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[1500-julian] ____________ 864s 864s calendar = 'julian', units_year = 1500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[1500-noleap] ____________ 864s 864s calendar = 'noleap', units_year = 1500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2000-360_day] ___________ 864s 864s calendar = '360_day', units_year = 2000 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2000-365_day] ___________ 864s 864s calendar = '365_day', units_year = 2000 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2000-366_day] ___________ 864s 864s calendar = '366_day', units_year = 2000 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s __________ test_use_cftime_false_nonstandard_calendar[2000-all_leap] ___________ 864s 864s calendar = 'all_leap', units_year = 2000 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2000-julian] ____________ 864s 864s calendar = 'julian', units_year = 2000 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2000-noleap] ____________ 864s 864s calendar = 'noleap', units_year = 2000 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2500-360_day] ___________ 864s 864s calendar = '360_day', units_year = 2500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2500-365_day] ___________ 864s 864s calendar = '365_day', units_year = 2500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2500-366_day] ___________ 864s 864s calendar = '366_day', units_year = 2500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s __________ test_use_cftime_false_nonstandard_calendar[2500-all_leap] ___________ 864s 864s calendar = 'all_leap', units_year = 2500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2500-julian] ____________ 864s 864s calendar = 'julian', units_year = 2500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ___________ test_use_cftime_false_nonstandard_calendar[2500-noleap] ____________ 864s 864s calendar = 'noleap', units_year = 2500 864s 864s @requires_scipy_or_netCDF4 864s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 864s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 864s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 864s x = [0, 1] 864s time = [0, 720] 864s units = f"days since {units_year}" 864s original = DataArray(x, [("time", time)], name="x").to_dataset() 864s for v in ["x", "time"]: 864s original[v].attrs["units"] = units 864s original[v].attrs["calendar"] = calendar 864s 864s with create_tmp_file() as tmp_file: 864s original.to_netcdf(tmp_file) 864s with pytest.raises((OutOfBoundsDatetime, ValueError)): 864s decoder = CFDatetimeCoder(use_cftime=False) 864s > open_dataset(tmp_file, decode_times=decoder) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ____________________ test_open_dataset_chunking_zarr[auto] _____________________ 864s 864s chunks = 'auto' 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar0') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 864s encoded_chunks = 100 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s _____________________ test_open_dataset_chunking_zarr[-1] ______________________ 864s 864s chunks = -1 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar1') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 864s encoded_chunks = 100 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___________________ test_open_dataset_chunking_zarr[chunks2] ___________________ 864s 864s chunks = {} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar2') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 864s encoded_chunks = 100 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___________________ test_open_dataset_chunking_zarr[chunks3] ___________________ 864s 864s chunks = {'x': 'auto'} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar3') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 864s encoded_chunks = 100 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___________________ test_open_dataset_chunking_zarr[chunks4] ___________________ 864s 864s chunks = {'x': -1} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar4') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 864s encoded_chunks = 100 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___________________ test_open_dataset_chunking_zarr[chunks5] ___________________ 864s 864s chunks = {'x': 'auto', 'y': -1} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar5') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 864s encoded_chunks = 100 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s _______________________ test_chunking_consintency[auto] ________________________ 864s 864s chunks = 'auto' 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_auto0') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 864s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 864s encoded_chunks: dict[str, Any] = {} 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s ds.to_netcdf(tmp_path / "test.nc") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with xr.open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ________________________ test_chunking_consintency[-1] _________________________ 864s 864s chunks = -1 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency__1_0') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 864s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 864s encoded_chunks: dict[str, Any] = {} 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s ds.to_netcdf(tmp_path / "test.nc") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with xr.open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ______________________ test_chunking_consintency[chunks2] ______________________ 864s 864s chunks = {} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun0') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 864s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 864s encoded_chunks: dict[str, Any] = {} 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s ds.to_netcdf(tmp_path / "test.nc") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with xr.open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ______________________ test_chunking_consintency[chunks3] ______________________ 864s 864s chunks = {'x': 'auto'} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun1') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 864s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 864s encoded_chunks: dict[str, Any] = {} 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s ds.to_netcdf(tmp_path / "test.nc") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with xr.open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ______________________ test_chunking_consintency[chunks4] ______________________ 864s 864s chunks = {'x': -1} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun2') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 864s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 864s encoded_chunks: dict[str, Any] = {} 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s ds.to_netcdf(tmp_path / "test.nc") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with xr.open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ______________________ test_chunking_consintency[chunks5] ______________________ 864s 864s chunks = {'x': 'auto', 'y': -1} 864s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun3') 864s 864s @requires_zarr 864s @requires_dask 864s @pytest.mark.parametrize( 864s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 864s ) 864s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 864s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 864s encoded_chunks: dict[str, Any] = {} 864s dask_arr = da.from_array( 864s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 864s ) 864s ds = xr.Dataset( 864s { 864s "test": xr.DataArray( 864s dask_arr, 864s dims=("x", "y"), 864s ) 864s } 864s ) 864s ds["test"].encoding["chunks"] = encoded_chunks 864s ds.to_zarr(tmp_path / "test.zarr") 864s ds.to_netcdf(tmp_path / "test.nc") 864s 864s with dask.config.set({"array.chunk-size": "1MiB"}): 864s expected = ds.chunk(chunks) 864s > with xr.open_dataset( 864s tmp_path / "test.zarr", engine="zarr", chunks=chunks 864s ) as actual: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 864s ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'test' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ________________ TestZarrDatatreeIO.test_to_zarr[zarr_format=3] ________________ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zarr_format_3_0') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s zarr_format = 3 864s 864s def test_to_zarr(self, tmpdir, simple_datatree, zarr_format): 864s filepath = str(tmpdir / "test.zarr") 864s original_dt = simple_datatree 864s original_dt.to_zarr(filepath, zarr_format=zarr_format) 864s 864s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:459: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s _____________ TestZarrDatatreeIO.test_zarr_encoding[zarr_format=3] _____________ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_zarr_encoding_zarr_format1') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s zarr_format = 3 864s 864s def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format): 864s filepath = str(tmpdir / "test.zarr") 864s original_dt = simple_datatree 864s 864s if zarr_format == 2: 864s from numcodecs.blosc import Blosc 864s 864s codec = Blosc(cname="zstd", clevel=3, shuffle=2) 864s comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec} 864s elif zarr_format == 3: 864s # specifying codecs in zarr_format=3 requires importing from zarr 3 namespace 864s import numcodecs.zarr3 864s 864s comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)} 864s 864s enc = {"/set2": {var: comp for var in original_dt["/set2"].dataset.data_vars}} 864s original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format) 864s 864s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:480: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=2] ___________ 864s 864s cls = 864s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 864s path = '', mode = 'r' 864s 864s @classmethod 864s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 864s """ 864s Open StorePath based on the provided mode. 864s 864s * If the mode is None, return an opened version of the store with no changes. 864s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 864s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 864s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 864s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 864s 864s Parameters 864s ---------- 864s mode : AccessModeLiteral 864s The mode to use when initializing the store path. 864s 864s The accepted values are: 864s 864s - ``'r'``: read only (must exist) 864s - ``'r+'``: read/write (must exist) 864s - ``'a'``: read/write (create if doesn't exist) 864s - ``'w'``: read/write (overwrite if exists) 864s - ``'w-'``: read/write (create if doesn't exist). 864s 864s Raises 864s ------ 864s FileExistsError 864s If the mode is 'w-' and the store path already exists. 864s ValueError 864s If the mode is not "r" and the store is read-only, or 864s """ 864s 864s # fastpath if mode is None 864s if mode is None: 864s return await cls._create_open_instance(store, path) 864s 864s if mode not in ANY_ACCESS_MODE: 864s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 864s 864s if store.read_only: 864s # Don't allow write operations on a read-only store 864s if mode != "r": 864s raise ValueError( 864s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 864s ) 864s self = await cls._create_open_instance(store, path) 864s elif mode == "r": 864s # Create read-only copy for read mode on writable store 864s try: 864s > read_only_store = store.with_read_only(True) 864s 864s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 864s read_only = True 864s 864s def with_read_only(self, read_only: bool = False) -> Store: 864s """ 864s Return a new store with a new read_only setting. 864s 864s The new store points to the same location with the specified new read_only state. 864s The returned Store is not automatically opened, and this store is 864s not automatically closed. 864s 864s Parameters 864s ---------- 864s read_only 864s If True, the store will be created in read-only mode. Defaults to False. 864s 864s Returns 864s ------- 864s A new store of the same type with the new read only attribute. 864s """ 864s > raise NotImplementedError( 864s f"with_read_only is not implemented for the {type(self)} store type." 864s ) 864s E NotImplementedError: with_read_only is not implemented for the store type. 864s 864s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 864s 864s The above exception was the direct cause of the following exception: 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s zarr_format = 2 864s 864s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 864s from zarr.storage import ZipStore 864s 864s filepath = str(tmpdir / "test.zarr.zip") 864s original_dt = simple_datatree 864s store = ZipStore(filepath, mode="w") 864s original_dt.to_zarr(store, zarr_format=zarr_format) 864s 864s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 864s stores = ZarrStore.open_store( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 864s ) = _get_open_params( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 864s zarr_root_group = zarr.open_group(store, **open_kwargs) 864s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 864s sync( 864s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 864s raise return_result 864s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 864s return await coro 864s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 864s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 864s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 864s return await StorePath.open(store, path=path_normalized, mode=mode) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s cls = 864s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 864s path = '', mode = 'r' 864s 864s @classmethod 864s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 864s """ 864s Open StorePath based on the provided mode. 864s 864s * If the mode is None, return an opened version of the store with no changes. 864s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 864s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 864s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 864s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 864s 864s Parameters 864s ---------- 864s mode : AccessModeLiteral 864s The mode to use when initializing the store path. 864s 864s The accepted values are: 864s 864s - ``'r'``: read only (must exist) 864s - ``'r+'``: read/write (must exist) 864s - ``'a'``: read/write (create if doesn't exist) 864s - ``'w'``: read/write (overwrite if exists) 864s - ``'w-'``: read/write (create if doesn't exist). 864s 864s Raises 864s ------ 864s FileExistsError 864s If the mode is 'w-' and the store path already exists. 864s ValueError 864s If the mode is not "r" and the store is read-only, or 864s """ 864s 864s # fastpath if mode is None 864s if mode is None: 864s return await cls._create_open_instance(store, path) 864s 864s if mode not in ANY_ACCESS_MODE: 864s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 864s 864s if store.read_only: 864s # Don't allow write operations on a read-only store 864s if mode != "r": 864s raise ValueError( 864s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 864s ) 864s self = await cls._create_open_instance(store, path) 864s elif mode == "r": 864s # Create read-only copy for read mode on writable store 864s try: 864s read_only_store = store.with_read_only(True) 864s except NotImplementedError as e: 864s > raise ValueError( 864s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 864s "Please use a read-only store or a storage class that implements .with_read_only()." 864s ) from e 864s 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(). 864s 864s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 864s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=3] ___________ 864s 864s cls = 864s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 864s path = '', mode = 'r' 864s 864s @classmethod 864s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 864s """ 864s Open StorePath based on the provided mode. 864s 864s * If the mode is None, return an opened version of the store with no changes. 864s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 864s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 864s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 864s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 864s 864s Parameters 864s ---------- 864s mode : AccessModeLiteral 864s The mode to use when initializing the store path. 864s 864s The accepted values are: 864s 864s - ``'r'``: read only (must exist) 864s - ``'r+'``: read/write (must exist) 864s - ``'a'``: read/write (create if doesn't exist) 864s - ``'w'``: read/write (overwrite if exists) 864s - ``'w-'``: read/write (create if doesn't exist). 864s 864s Raises 864s ------ 864s FileExistsError 864s If the mode is 'w-' and the store path already exists. 864s ValueError 864s If the mode is not "r" and the store is read-only, or 864s """ 864s 864s # fastpath if mode is None 864s if mode is None: 864s return await cls._create_open_instance(store, path) 864s 864s if mode not in ANY_ACCESS_MODE: 864s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 864s 864s if store.read_only: 864s # Don't allow write operations on a read-only store 864s if mode != "r": 864s raise ValueError( 864s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 864s ) 864s self = await cls._create_open_instance(store, path) 864s elif mode == "r": 864s # Create read-only copy for read mode on writable store 864s try: 864s > read_only_store = store.with_read_only(True) 864s 864s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 864s read_only = True 864s 864s def with_read_only(self, read_only: bool = False) -> Store: 864s """ 864s Return a new store with a new read_only setting. 864s 864s The new store points to the same location with the specified new read_only state. 864s The returned Store is not automatically opened, and this store is 864s not automatically closed. 864s 864s Parameters 864s ---------- 864s read_only 864s If True, the store will be created in read-only mode. Defaults to False. 864s 864s Returns 864s ------- 864s A new store of the same type with the new read only attribute. 864s """ 864s > raise NotImplementedError( 864s f"with_read_only is not implemented for the {type(self)} store type." 864s ) 864s E NotImplementedError: with_read_only is not implemented for the store type. 864s 864s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 864s 864s The above exception was the direct cause of the following exception: 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s zarr_format = 3 864s 864s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 864s from zarr.storage import ZipStore 864s 864s filepath = str(tmpdir / "test.zarr.zip") 864s original_dt = simple_datatree 864s store = ZipStore(filepath, mode="w") 864s original_dt.to_zarr(store, zarr_format=zarr_format) 864s 864s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 864s stores = ZarrStore.open_store( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 864s ) = _get_open_params( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 864s zarr_root_group = zarr.open_group(store, **open_kwargs) 864s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 864s sync( 864s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 864s raise return_result 864s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 864s return await coro 864s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 864s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 864s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 864s return await StorePath.open(store, path=path_normalized, mode=mode) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s cls = 864s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 864s path = '', mode = 'r' 864s 864s @classmethod 864s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 864s """ 864s Open StorePath based on the provided mode. 864s 864s * If the mode is None, return an opened version of the store with no changes. 864s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 864s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 864s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 864s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 864s 864s Parameters 864s ---------- 864s mode : AccessModeLiteral 864s The mode to use when initializing the store path. 864s 864s The accepted values are: 864s 864s - ``'r'``: read only (must exist) 864s - ``'r+'``: read/write (must exist) 864s - ``'a'``: read/write (create if doesn't exist) 864s - ``'w'``: read/write (overwrite if exists) 864s - ``'w-'``: read/write (create if doesn't exist). 864s 864s Raises 864s ------ 864s FileExistsError 864s If the mode is 'w-' and the store path already exists. 864s ValueError 864s If the mode is not "r" and the store is read-only, or 864s """ 864s 864s # fastpath if mode is None 864s if mode is None: 864s return await cls._create_open_instance(store, path) 864s 864s if mode not in ANY_ACCESS_MODE: 864s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 864s 864s if store.read_only: 864s # Don't allow write operations on a read-only store 864s if mode != "r": 864s raise ValueError( 864s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 864s ) 864s self = await cls._create_open_instance(store, path) 864s elif mode == "r": 864s # Create read-only copy for read mode on writable store 864s try: 864s read_only_store = store.with_read_only(True) 864s except NotImplementedError as e: 864s > raise ValueError( 864s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 864s "Please use a read-only store or a storage class that implements .with_read_only()." 864s ) from e 864s 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(). 864s 864s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 864s _______ TestZarrDatatreeIO.test_to_zarr_not_consolidated[zarr_format=3] ________ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_not_consolidated_1') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s zarr_format = 3 864s 864s def test_to_zarr_not_consolidated(self, tmpdir, simple_datatree, zarr_format): 864s filepath = tmpdir / "test.zarr" 864s zmetadata = filepath / ".zmetadata" 864s s1zmetadata = filepath / "set1" / ".zmetadata" 864s filepath = str(filepath) # casting to str avoids a pathlib bug in xarray 864s original_dt = simple_datatree 864s original_dt.to_zarr(filepath, consolidated=False, zarr_format=zarr_format) 864s assert not zmetadata.exists() 864s assert not s1zmetadata.exists() 864s 864s with pytest.warns(RuntimeWarning, match="consolidated"): 864s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:514: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ________ TestZarrDatatreeIO.test_open_groups_round_trip[zarr_format=3] _________ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_groups_round_trip_za1') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s zarr_format = 3 864s 864s def test_open_groups_round_trip(self, tmpdir, simple_datatree, zarr_format) -> None: 864s """Test `open_groups` opens a zarr store with the `simple_datatree` structure.""" 864s filepath = str(tmpdir / "test.zarr") 864s original_dt = simple_datatree 864s original_dt.to_zarr(filepath, zarr_format=zarr_format) 864s 864s > roundtrip_dict = open_groups(filepath, engine="zarr") 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:631: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 864s backend_groups = backend.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s _____________ TestZarrDatatreeIO.test_open_datatree[zarr_format=3] _____________ 864s 864s self = 864s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0x3ff720668d0> 864s zarr_format = 3 864s 864s @pytest.mark.filterwarnings( 864s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 864s ) 864s def test_open_datatree(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 864s """Test if `open_datatree` fails to open a zarr store with an unaligned group hierarchy.""" 864s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 864s 864s with pytest.raises( 864s ValueError, 864s match=( 864s re.escape("group '/Group2' is not aligned with its parents:") + ".*" 864s ), 864s ): 864s > open_datatree(storepath, engine="zarr") 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:653: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s _________ TestZarrDatatreeIO.test_open_datatree_chunks[zarr_format=3] __________ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_chunks_zarr1') 864s zarr_format = 3 864s 864s @requires_dask 864s def test_open_datatree_chunks(self, tmpdir, zarr_format) -> None: 864s filepath = str(tmpdir / "test.zarr") 864s 864s chunks = {"x": 2, "y": 1} 864s 864s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 864s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 864s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 864s original_tree = DataTree.from_dict( 864s { 864s "/": root_data.chunk(chunks), 864s "/group1": set1_data.chunk(chunks), 864s "/group2": set2_data.chunk(chunks), 864s } 864s ) 864s original_tree.to_zarr(filepath, zarr_format=zarr_format) 864s 864s > with open_datatree(filepath, engine="zarr", chunks=chunks) as tree: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:673: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ______________ TestZarrDatatreeIO.test_open_groups[zarr_format=3] ______________ 864s 864s self = 864s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0x3ff720668d0> 864s zarr_format = 3 864s 864s @pytest.mark.filterwarnings( 864s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 864s ) 864s def test_open_groups(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 864s """Test `open_groups` with a zarr store of an unaligned group hierarchy.""" 864s 864s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 864s > unaligned_dict_of_datasets = open_groups(storepath, engine="zarr") 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:689: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 864s backend_groups = backend.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[True-zarr_format=3] ___ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr1') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s write_consolidated_metadata = True, zarr_format = 3 864s 864s @pytest.mark.filterwarnings( 864s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 864s ) 864s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 864s def test_open_datatree_specific_group( 864s self, 864s tmpdir, 864s simple_datatree, 864s write_consolidated_metadata, 864s zarr_format, 864s ) -> None: 864s """Test opening a specific group within a Zarr store using `open_datatree`.""" 864s filepath = str(tmpdir / "test.zarr") 864s group = "/set2" 864s original_dt = simple_datatree 864s original_dt.to_zarr( 864s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 864s ) 864s expected_subtree = original_dt[group].copy() 864s expected_subtree.orphan() 864s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s __ TestZarrDatatreeIO.test_open_datatree_specific_group[False-zarr_format=3] ___ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr3') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s write_consolidated_metadata = False, zarr_format = 3 864s 864s @pytest.mark.filterwarnings( 864s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 864s ) 864s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 864s def test_open_datatree_specific_group( 864s self, 864s tmpdir, 864s simple_datatree, 864s write_consolidated_metadata, 864s zarr_format, 864s ) -> None: 864s """Test opening a specific group within a Zarr store using `open_datatree`.""" 864s filepath = str(tmpdir / "test.zarr") 864s group = "/set2" 864s original_dt = simple_datatree 864s original_dt.to_zarr( 864s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 864s ) 864s expected_subtree = original_dt[group].copy() 864s expected_subtree.orphan() 864s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[None-zarr_format=3] ___ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr5') 864s simple_datatree = 864s Group: / 864s │ Dimensions: (y: 3, x: 2) 864s │ Dimensions without coordinates: y, x 864s │ Data variables: 864s ... a (x) int64 16B 2 3 864s │ │ b (x) float64 16B 0.1 0.2 864s │ └── Group: /set2/set1 864s └── Group: /set3 864s write_consolidated_metadata = None, zarr_format = 3 864s 864s @pytest.mark.filterwarnings( 864s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 864s ) 864s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 864s def test_open_datatree_specific_group( 864s self, 864s tmpdir, 864s simple_datatree, 864s write_consolidated_metadata, 864s zarr_format, 864s ) -> None: 864s """Test opening a specific group within a Zarr store using `open_datatree`.""" 864s filepath = str(tmpdir / "test.zarr") 864s group = "/set2" 864s original_dt = simple_datatree 864s original_dt.to_zarr( 864s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 864s ) 864s expected_subtree = original_dt[group].copy() 864s expected_subtree.orphan() 864s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 864s backend_tree = backend.open_datatree( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 864s groups_dict = self.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s __________ TestZarrDatatreeIO.test_open_groups_chunks[zarr_format=3] ___________ 864s 864s self = 864s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_groups_chunks_zarr_f1') 864s zarr_format = 3 864s 864s @requires_dask 864s def test_open_groups_chunks(self, tmpdir, zarr_format) -> None: 864s """Test `open_groups` with chunks on a zarr store.""" 864s 864s chunks = {"x": 2, "y": 1} 864s filepath = str(tmpdir / "test.zarr") 864s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 864s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 864s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 864s original_tree = DataTree.from_dict( 864s { 864s "/": root_data.chunk(chunks), 864s "/group1": set1_data.chunk(chunks), 864s "/group2": set2_data.chunk(chunks), 864s } 864s ) 864s original_tree.to_zarr(filepath, mode="w", zarr_format=zarr_format) 864s 864s > dict_of_datasets = open_groups(filepath, engine="zarr", chunks=chunks) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:752: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 864s backend_groups = backend.open_groups_as_dict( 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 864s group_ds = store_entrypoint.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 864s vars, attrs = filename_or_obj.load() 864s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 864s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 864s return Frozen(dict(*args, **kwargs)) 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 864s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s self = , name = 'b' 864s 864s def open_store_variable(self, name): 864s zarr_array = self.members[name] 864s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 864s try_nczarr = self._mode == "r" 864s dimensions, attributes = _get_zarr_dims_and_attrs( 864s zarr_array, DIMENSION_KEY, try_nczarr 864s ) 864s attributes = dict(attributes) 864s 864s encoding = { 864s "chunks": zarr_array.chunks, 864s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 864s } 864s 864s if _zarr_v3(): 864s encoding.update( 864s { 864s "compressors": zarr_array.compressors, 864s "filters": zarr_array.filters, 864s "shards": zarr_array.shards, 864s } 864s ) 864s if self.zarr_group.metadata.zarr_format == 3: 864s encoding.update({"serializer": zarr_array.serializer}) 864s else: 864s encoding.update( 864s { 864s "compressor": zarr_array.compressor, 864s "filters": zarr_array.filters, 864s } 864s ) 864s 864s if self._use_zarr_fill_value_as_mask: 864s # Setting this attribute triggers CF decoding for missing values 864s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 864s if zarr_array.fill_value is not None: 864s attributes["_FillValue"] = zarr_array.fill_value 864s elif "_FillValue" in attributes: 864s original_zarr_dtype = zarr_array.metadata.data_type 864s attributes["_FillValue"] = FillValueCoder.decode( 864s > attributes["_FillValue"], original_zarr_dtype.value 864s ) 864s E AttributeError: 'Float64' object has no attribute 'value' 864s 864s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 864s ______________________ test_normalize_token_with_backend _______________________ 864s 864s map_ds = Size: 9kB 864s Dimensions: (x: 10, y: 20, z: 4) 864s Coordinates: 864s * x (x) int64 80B 0 1 2 3 4 5 6 7 8...2B 1 1 1 1 864s e (x, y) int64 2kB 100 101 102 103 104 105 ... 124 125 126 127 128 864s Attributes: 864s test: test 864s 864s @requires_scipy_or_netCDF4 864s def test_normalize_token_with_backend(map_ds): 864s with create_tmp_file(allow_cleanup_failure=ON_WINDOWS) as tmp_file: 864s map_ds.to_netcdf(tmp_file) 864s > read = xr.open_dataset(tmp_file) 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_dask.py:1648: 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 864s backend_ds = backend.open_dataset( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 864s store = NetCDF4DataStore.open( 864s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 864s import netCDF4 864s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 864s 864s # init for netCDF4. package 864s # Docstring comes from extension module _netCDF4. 864s > from ._netCDF4 import * 864s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 864s 864s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 864s ______________________________ test_list_engines _______________________________ 864s 864s def test_list_engines() -> None: 864s from xarray.backends import list_engines 864s 864s engines = list_engines() 864s assert list_engines.cache_info().currsize == 1 864s 864s assert ("scipy" in engines) == has_scipy 864s > assert ("h5netcdf" in engines) == has_h5netcdf 864s 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 864s 864s /usr/lib/python3/dist-packages/xarray/tests/test_plugins.py:272: AssertionError 864s =============================== warnings summary =============================== 864s ../../../../usr/lib/python3/dist-packages/pyparsing/core.py:5637 864s /usr/lib/python3/dist-packages/pyparsing/core.py:5637: SyntaxWarning: 'return' in a 'finally' block 864s return f"{type(self).__name__}: {retString}" 864s 864s tests/test_backends.py: 539 warnings 864s tests/test_backends_datatree.py: 15 warnings 864s /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. 864s warnings.warn( 864s 864s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 864s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 864s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 864s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=6, endianness='big')) 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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py: 111 warnings 864s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=1, endianness='big')) 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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 864s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 864s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py: 99 warnings 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 864s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 864s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py: 12 warnings 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 864s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 864s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 864s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=4, endianness='big')) 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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 864s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 864s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py: 33 warnings 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py: 30 warnings 864s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=2, endianness='big')) 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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends.py: 27 warnings 864s /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. 864s v3_unstable_dtype_warning(self) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 864s /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. 864s super().__init__(**codec_config) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 864s /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. 864s super().__init__(**codec_config) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: '.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: '.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/.zarray' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/.zarray' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/.zarray' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/.zarray' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/.zarray' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/.zarray' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/.zgroup' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/.zattrs' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/zarr.json' 864s return self._open_to_write(zinfo, force_zip64=force_zip64) 864s 864s tests/test_conventions.py: 1 warning 864s tests/test_rolling.py: 36 warnings 864s /usr/lib/python3/dist-packages/xarray/core/duck_array_ops.py:237: RuntimeWarning: invalid value encountered in cast 864s return data.astype(dtype, **kwargs) 864s 864s tests/test_dask.py: 12 warnings 864s tests/test_units.py: 10 warnings 864s /usr/lib/python3/dist-packages/numpy/_core/numeric.py:476: RuntimeWarning: invalid value encountered in cast 864s multiarray.copyto(res, fill_value, casting='unsafe') 864s 864s tests/test_duck_array_ops.py: 16 warnings 864s /usr/lib/python3/dist-packages/dask/array/core.py:5083: RuntimeWarning: overflow encountered in scalar add 864s result = function(*args, **kwargs) 864s 864s tests/test_duck_array_ops.py::test_cftime_datetime_mean[True] 864s /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. 864s result = function(*args, **kwargs) 864s 864s tests/test_duck_array_wrapping.py::TestDataArrayMethods::test_astype[pint] 864s /usr/lib/python3/dist-packages/pint/facets/numpy/quantity.py:88: RuntimeWarning: invalid value encountered in cast 864s value = func(*args, **kwargs) 864s 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s /usr/lib/python3/dist-packages/xarray/tests/test_strategies.py:277: RuntimeWarning: Mean of empty slice 864s expected = np.nanmean(var.data, axis=reduction_axes) 864s 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s tests/test_strategies.py::TestReduction::test_mean 864s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce 864s return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 864s 864s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-compatible_unit-function_clip] 864s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-identical_unit-function_clip] 864s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-compatible_unit-function_clip] 864s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-identical_unit-function_clip] 864s /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) 864s return conv.wrap(result, to_scalar=False) 864s 864s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_ffill] 864s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_bfill] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2766: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py: 15 warnings 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2803: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataArray::test_dropna[int64] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2831: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 864s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 864s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 864s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 864s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2856: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 864s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 864s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 864s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 864s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2861: RuntimeWarning: invalid value encountered in cast 864s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 864s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4252: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 864s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4256: RuntimeWarning: invalid value encountered in cast 864s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 864s 864s tests/test_units.py: 15 warnings 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4295: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py: 15 warnings 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4299: RuntimeWarning: invalid value encountered in cast 864s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_dropna[int64] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4325: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_dropna[int64] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4329: RuntimeWarning: invalid value encountered in cast 864s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 864s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4353: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 864s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4357: RuntimeWarning: invalid value encountered in cast 864s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 864s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 864s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4362: RuntimeWarning: invalid value encountered in cast 864s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_interpolate_na[int64] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4438: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_interpolate_na[int64] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4442: RuntimeWarning: invalid value encountered in cast 864s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 864s 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4487: RuntimeWarning: invalid value encountered in cast 864s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) * data_unit 864s 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 864s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 864s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4490: RuntimeWarning: invalid value encountered in cast 864s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) * data_unit 864s 864s tests/test_variable.py::TestIndexVariable::test_to_index_multiindex_level 864s /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)`. 864s ds = Dataset(coords={"x": midx}) 864s 864s tests/test_weighted.py::test_weighted_quantile_3D[None-True-q1-a] 864s tests/test_weighted.py::test_weighted_quantile_3D[True-True-0.5-a] 864s /usr/lib/python3/dist-packages/numpy/lib/_nanfunctions_impl.py:1617: RuntimeWarning: All-NaN slice encountered 864s return fnb._ureduce(a, 864s 864s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 864s =========================== short test summary info ============================ 864s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_store[3] - Attri... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_load[3] - AttributeErr... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - A... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - At... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_dropna[3] - AttributeE... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_bytes_with_fill_value[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - At... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_overwrite_values[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - Attrib... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - Attr... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - At... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - At... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_group[3] - AttributeEr... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_write[3] - Attr... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_not_set_raises[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - A... 864s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 864s FAILED tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_store[3] - ... 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_test_data[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_load[3] - Attribu... 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dataset_compute[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_object_dtype[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_float64_data[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_orthogonal_indexing[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing_negative_step[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_outer_indexing_reversed[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_isel_dataarray[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_array_type_after_indexing[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dropna[3] - Attri... 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_ondisk_after_print[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_bytes_with_fill_value[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value0-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value1-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3--1-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-255-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_coordinate_variables_after_dataset_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_kwarg[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_default_fill_value[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_same_dtype[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_overwrite_values[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_read_non_consolidated_warning[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_auto_chunk[3] - A... 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_manual_chunk[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_warning_on_bad_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_uneven_dask_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_shard_encoding[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-group1] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_compressor_encoding[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_group[3] - Attrib... 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_write[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_not_set_raises[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-U] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-S] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_check_encoding_is_consistent_after_append[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_new_variable[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_no_overwrite[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_compute_false_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_append_compute_false_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_no_warning_from_open_emptydim_with_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-False] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-True] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-None] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-r+] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-a] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_preexisting_override_metadata[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_chunksizes[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding_with_partial_dask_chunks[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_open_zarr_use_cftime[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_read_select_write[3] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_attributes[3-obj1] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 864s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zarr_fill_value_setting[3-float] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_store[3] - Attr... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_test_data[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_load[3] - AttributeEr... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dataset_compute[3] - ... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_object_dtype[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_float64_data[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_orthogonal_indexing[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing_negative_step[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_outer_indexing_reversed[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_isel_dataarray[3] - A... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_array_type_after_indexing[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dropna[3] - Attribute... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_ondisk_after_print[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_bytes_with_fill_value[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value0-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value1-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3--1-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-255-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_coordinate_variables_after_dataset_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_kwarg[3] - A... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_default_fill_value[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_same_dtype[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_overwrite_values[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_read_non_consolidated_warning[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_auto_chunk[3] - Attri... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_manual_chunk[3] - Att... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_warning_on_bad_chunks[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_uneven_dask_chunks[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding[3] - A... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_shard_encoding[3] - A... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-group1] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_compressor_encoding[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_group[3] - AttributeE... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_write[3] - Att... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_not_set_raises[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-U] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-S] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_check_encoding_is_consistent_after_append[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_new_variable[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_no_overwrite[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_compute_false_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_append_compute_false_roundtrip[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_no_warning_from_open_emptydim_with_chunks[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-r+] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-a] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_preexisting_override_metadata[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_chunksizes[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding_with_partial_dask_chunks[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_open_zarr_use_cftime[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_read_select_write[3] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_attributes[3-obj1] - ... 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zarr_fill_value_setting[3-float] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-None] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-True] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-False] 864s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-None] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-full-auto] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-mixed-auto] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_index_write[3] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region[3] - Attr... 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_append_chunk_partial[3] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_chunk_partial_offset[3] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_append_dim[3] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-r+] 864s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-a] 864s FAILED tests/test_backends.py::TestScipyFilePath::test_roundtrip_example_1_netcdf_gz 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_zero_dimensional_variable 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_test_data 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_load - ModuleNotFo... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dataset_compute - ... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_pickle - ModuleNot... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_pickle_dataarray 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dataset_caching - ... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_None_variable 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_object_dtype 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_string_data 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_string_encoded_characters 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_numpy_datetime_data 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_cftime_datetime_data 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_timedelta_data 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_float64_data 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_coordinates 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_global_coordinates 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_coordinates_with_space 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_boolean_dtype 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_orthogonal_indexing 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_vectorized_indexing 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_vectorized_indexing_negative_step 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_outer_indexing_reversed 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_isel_dataarray - M... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_array_type_after_indexing 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dropna - ModuleNot... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_ondisk_after_print 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_bytes_with_fill_value 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_empty_vlen_string_array 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[fill_value0-False] 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[fill_value1-True] 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[-1-False] 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[255-True] 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_grid_mapping_and_bounds_are_not_coordinates_in_file 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_coordinate_variables_after_dataset_roundtrip 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_coordinates_encoding 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg - M... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg_dates 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg_fixed_width_string 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_default_fill_value 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_via_encoding_kwarg 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_in_coord 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_same_dtype 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_append_write - Mod... 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_append_overwrite_values 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_multiindex_not_implemented 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_string_object_warning 864s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_unlimited_dims 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-all-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-different-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-all-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-different-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-different-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-all-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-all-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-minimal-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-minimal-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-different-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-different-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-all-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-all-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-minimal-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-minimal-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-different-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-different-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[drop] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[override] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[no_conflicts] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[identical] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[drop_conflicts] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_attr_by_coords 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataarray_attr_by_coords 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[all-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[all-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[minimal-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[minimal-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[different-nested-t] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[different-by_coords-None] 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_common_coord_when_datavars_all 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_common_coord_when_datavars_minimal 864s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_invalid_data_vars_value_should_fail 864s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_no_name 864s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_with_name 864s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_coord_name_clash 864s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_open_dataarray_options 864s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_no_name_pathlib 864s FAILED tests/test_backends.py::test_source_encoding_always_present - ModuleNo... 864s FAILED tests/test_backends.py::test_source_encoding_always_present_with_pathlib 864s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[proleptic_gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[standard] 864s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_out_of_range[standard] 864s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_out_of_range[gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-360_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-365_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-366_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-all_leap] - ModuleNo... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-gregorian] - ModuleN... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-julian] - ModuleNotF... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-noleap] - ModuleNotF... 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-proleptic_gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_true[1500-standard] - ModuleNo... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-360_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-365_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-366_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-all_leap] - ModuleNo... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-gregorian] - ModuleN... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-julian] - ModuleNotF... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-noleap] - ModuleNotF... 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-proleptic_gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_true[2000-standard] - ModuleNo... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-360_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-365_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-366_day] - ModuleNot... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-all_leap] - ModuleNo... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-gregorian] - ModuleN... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-julian] - ModuleNotF... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-noleap] - ModuleNotF... 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-proleptic_gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_true[2500-standard] - ModuleNo... 864s FAILED tests/test_backends.py::test_use_cftime_false_standard_calendar_out_of_range[standard] 864s FAILED tests/test_backends.py::test_use_cftime_false_standard_calendar_out_of_range[gregorian] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-360_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-365_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-366_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-all_leap] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-julian] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-noleap] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-360_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-365_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-366_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-all_leap] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-julian] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-noleap] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-360_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-365_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-366_day] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-all_leap] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-julian] 864s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-noleap] 864s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[auto] - Attrib... 864s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[-1] - Attribut... 864s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks2] - Att... 864s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks3] - Att... 864s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks4] - Att... 864s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks5] - Att... 864s FAILED tests/test_backends.py::test_chunking_consintency[auto] - AttributeErr... 864s FAILED tests/test_backends.py::test_chunking_consintency[-1] - AttributeError... 864s FAILED tests/test_backends.py::test_chunking_consintency[chunks2] - Attribute... 864s FAILED tests/test_backends.py::test_chunking_consintency[chunks3] - Attribute... 864s FAILED tests/test_backends.py::test_chunking_consintency[chunks4] - Attribute... 864s FAILED tests/test_backends.py::test_chunking_consintency[chunks5] - Attribute... 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_not_consolidated[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_round_trip[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_chunks[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups[zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[True-zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[False-zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[None-zarr_format=3] 864s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_chunks[zarr_format=3] 864s FAILED tests/test_dask.py::test_normalize_token_with_backend - ModuleNotFound... 864s FAILED tests/test_plugins.py::test_list_engines - AssertionError: assert ('h5... 864s = 514 failed, 18358 passed, 2690 skipped, 51 deselected, 234 xfailed, 45 xpassed, 1115 warnings in 653.77s (0:10:53) = 868s E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build; python3.14 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 868s I: pybuild base:311: cd /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build; python3.13 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 878s ============================= test session starts ============================== 878s platform linux -- Python 3.13.9, pytest-8.3.5, pluggy-1.6.0 878s rootdir: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build 878s configfile: pyproject.toml 878s plugins: hypothesis-6.130.5, typeguard-4.4.2, zarr-3.1.3, mypy-plugins-3.2.0, xdist-3.8.0 878s collected 21888 items / 51 deselected / 4 skipped / 21837 selected 878s 879s tests/test_accessor_dt.py .............................................. [ 0%] 879s ........................................................................ [ 0%] 879s ........................................................................ [ 0%] 880s ........................................................................ [ 1%] 881s ........................................................................ [ 1%] 881s .................... [ 1%] 881s tests/test_accessor_str.py ............................................. [ 1%] 881s ........................................................................ [ 2%] 881s ........................................................................ [ 2%] 881s ...................................... [ 2%] 881s tests/test_assertions.py .............................. [ 2%] 883s tests/test_backends.py .................s...............XxXxXXxXxX...... [ 3%] 884s .s.s....................................................s............... [ 3%] 886s ....s..............XxXxXXxXxX.......s.s................................. [ 3%] 888s ..................s..s...................s...............XxXsXsssss..... [ 4%] 891s ..s..................Fs........s.s.................ss................... [ 4%] 894s ..........................................................s............. [ 4%] 898s ..XxXsXsssss.......s..................Fs........s.s.................ss.. [ 5%] 903s ........................................................................ [ 5%] 907s ...s...............XxXsXsssss.......s..................Fs........s.s.... [ 5%] 910s .............ss......................................................... [ 5%] 920s .....FFF......................FFFFF...F.....Fs....FFFFFFFFF..xxxsxsssssF [ 6%] 936s FFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ssFFFFFFFFFFFFFFFFF [ 6%] 952s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF...F.....Fs....FFFFF [ 6%] 966s FFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ss [ 7%] 983s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF... [ 7%] 998s F.....Fs....FFFFFFFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss. [ 7%] 1014s FFFF...F....F..ssFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.F [ 8%] 1023s F.FFF...FFFFFFFFFF....FF.F.F.FFFFFs..................s...............XxX [ 8%] 1025s sXXxXsX.......s.s................................s...............XxXsXXx [ 8%] 1026s XsX.......s.s...............ss.................s...............XxXsXXxXs [ 9%] 1028s X.......s.s....................................s...............XxXsXXxXs [ 9%] 1030s X.......s.s.................................s...............XxXsXXxXsX.. [ 9%] 1032s .....s.s...............................s...............XxXsXXxXsX....... [ 10%] 1035s s.s...................................s...............XxXsXXxXsX.......s [ 10%] 1038s .s.............................................sss...................... [ 10%] 1041s .......s...............XxXsXXxXsX.......s.s............................. [ 11%] 1045s ................sss.............................s...............XxXsXXxX [ 11%] 1046s sX.......s.s.............................................sss...........s [ 11%] 1046s ..ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.... [ 12%] 1048s .................................................s..................s... [ 12%] 1049s ..........................sssssss..x........s..s..s..s.sss.............. [ 12%] 1052s ......................XXX........................s.FFFFFFFFFFFF......Fss [ 13%] 1052s . [ 13%] 1052s tests/test_backends_api.py ........................ [ 13%] 1052s tests/test_backends_common.py ... [ 13%] 1055s tests/test_backends_datatree.py ..................F.FFF.F.......F.F.F.F. [ 13%] 1055s F.F.F.F...... [ 13%] 1058s tests/test_backends_file_manager.py ............................... [ 13%] 1058s tests/test_backends_locks.py . [ 13%] 1058s tests/test_backends_lru_cache.py ........ [ 13%] 1060s tests/test_calendar_ops.py ........................... [ 13%] 1060s tests/test_cftime_offsets.py ........................................... [ 14%] 1060s ........................................................................ [ 14%] 1060s ........................................................................ [ 14%] 1060s ........................................................................ [ 15%] 1060s ........................................................................ [ 15%] 1060s ........................................................................ [ 15%] 1060s ........................................................................ [ 16%] 1060s ........................................................................ [ 16%] 1060s ........................................................................ [ 16%] 1060s ........................................................................ [ 17%] 1060s ........................................................................ [ 17%] 1060s ........................................................................ [ 17%] 1060s ........................................................................ [ 18%] 1060s ........................................................................ [ 18%] 1060s ........................................................................ [ 18%] 1061s ........................................................................ [ 19%] 1061s ........................................................................ [ 19%] 1061s ........................................................................ [ 19%] 1061s ........................................................................ [ 20%] 1061s ........................................................................ [ 20%] 1061s ........................................................................ [ 20%] 1061s ........................................................................ [ 21%] 1061s ........................................................................ [ 21%] 1061s ........................................................................ [ 21%] 1061s ........................................................................ [ 22%] 1061s ........................................................................ [ 22%] 1061s ........................................................................ [ 22%] 1061s ........................................................................ [ 23%] 1061s ........................................................................ [ 23%] 1061s ........................................................................ [ 23%] 1062s ........................................................................ [ 24%] 1062s ........................................................................ [ 24%] 1062s ........................................................................ [ 24%] 1062s ........................................................................ [ 24%] 1062s ........................................................................ [ 25%] 1062s ........................................................................ [ 25%] 1062s ........................................................................ [ 25%] 1062s ........................................................................ [ 26%] 1062s ........................................................................ [ 26%] 1062s .............ssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 26%] 1062s .ssss....ssss....ssss....ssss.................................. [ 27%] 1062s tests/test_cftimeindex.py .............................................. [ 27%] 1063s ........................................................................ [ 27%] 1063s ........................................................................ [ 28%] 1063s ........................................................................ [ 28%] 1063s ........................................................................ [ 28%] 1063s ........................................................................ [ 29%] 1063s ........................................................................ [ 29%] 1063s ........................................................................ [ 29%] 1063s ........................................................................ [ 30%] 1064s ........................................................................ [ 30%] 1064s ........................................................................ [ 30%] 1064s ........................................................................ [ 31%] 1064s ...........................................x............................ [ 31%] 1064s ........................................................................ [ 31%] 1064s ................................................ [ 31%] 1064s tests/test_cftimeindex_resample.py ..................................... [ 32%] 1065s ........................................................................ [ 32%] 1065s ........................................................................ [ 32%] 1066s ........................................................................ [ 33%] 1067s ........................................................................ [ 33%] 1067s ........................................................................ [ 33%] 1068s ........................................................................ [ 34%] 1068s ................................................ [ 34%] 1069s tests/test_coarsen.py .................................................. [ 34%] 1070s ........................................................................ [ 34%] 1070s ..........s.......s.......s.......s.......s.......s.......s.......s..... [ 35%] 1070s .... [ 35%] 1070s tests/test_coding.py ............................... [ 35%] 1070s tests/test_coding_strings.py ....................... [ 35%] 1070s tests/test_coding_times.py ............................................. [ 35%] 1070s ........................................................................ [ 36%] 1070s ........................................................................ [ 36%] 1070s ........................................................................ [ 36%] 1070s ........................................................................ [ 37%] 1071s ........................................................................ [ 37%] 1071s ........................................................................ [ 37%] 1071s ........................................................................ [ 38%] 1071s ........................................................................ [ 38%] 1071s ........................................................................ [ 38%] 1071s ...................s.................................................... [ 39%] 1072s ........................................................................ [ 39%] 1072s ........................................................................ [ 39%] 1072s ......................................ssssssss......s......s......s..... [ 39%] 1073s .s......s............................................................... [ 40%] 1073s .......................................................... [ 40%] 1074s tests/test_combine.py .......................................x.......... [ 40%] 1074s ...................................................... [ 41%] 1074s tests/test_computation.py .............................................. [ 41%] 1075s ........................................................................ [ 41%] 1076s ........................................................................ [ 41%] 1078s ........................................................................ [ 42%] 1079s ..................................XxXx. [ 42%] 1079s tests/test_concat.py ................................................... [ 42%] 1080s ................................................. [ 42%] 1080s tests/test_conventions.py .............................................. [ 43%] 1081s ...s..............XxXsXXxXsX.......s.s............s........... [ 43%] 1081s tests/test_coordinate_transform.py ............ [ 43%] 1081s tests/test_coordinates.py ...................... [ 43%] 1083s tests/test_dask.py ..................................................... [ 43%] 1092s ..........XXx.X......................................................... [ 44%] 1093s ........................................................................ [ 44%] 1094s ...................... [ 44%] 1095s tests/test_dataarray.py ................................................ [ 44%] 1095s ........................................................................ [ 45%] 1095s ........................................................................ [ 45%] 1095s ........................................................................ [ 45%] 1096s s...ss......................................Xx.......................... [ 46%] 1097s ..........................ss....ss...................................... [ 46%] 1099s ............x.....................................x.......x............. [ 46%] 1100s ................sssssssssssss.................ss...... [ 47%] 1140s tests/test_dataarray_typing.yml .............. [ 47%] 1143s tests/test_dataset.py .................................................. [ 47%] 1143s ........................................................................ [ 47%] 1144s ......Xx...................................................s............ [ 47%] 1144s ..............................................s......................... [ 48%] 1145s ........................................................................ [ 48%] 1146s ...............................................................ss....ss. [ 48%] 1148s ......................................................................ss [ 49%] 1148s ... [ 49%] 1188s tests/test_dataset_typing.yml .............. [ 49%] 1189s tests/test_datatree.py ............................xx..........x......x. [ 49%] 1189s ........................................................................ [ 49%] 1189s ........x.......... [ 49%] 1189s tests/test_datatree_mapping.py .............x........ [ 50%] 1232s tests/test_datatree_typing.yml .............. [ 50%] 1232s tests/test_deprecation_helpers.py .. [ 50%] 1232s tests/test_dtypes.py ................................................... [ 50%] 1232s ...sss... [ 50%] 1233s tests/test_duck_array_ops.py ......s...........s........................ [ 50%] 1233s ..................................................................s..... [ 50%] 1233s ..................................ss..............ss..............ss.... [ 51%] 1234s ..ss......ss..............ss............................................ [ 51%] 1236s ..........ss......ss..............................ss..............ss.... [ 51%] 1237s ..........ss......ss......ss..............ss............................ [ 52%] 1238s ..........................ss......ss................ssssssssss.......... [ 52%] 1238s ssssssssss..........ssssssssss..........ssssssssss..........ssssss...... [ 52%] 1239s ........ssssss..............ssssss..............ssssss..............ssss [ 53%] 1239s sssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s. [ 53%] 1239s 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%] 1240s s.s.s.s.s.s............................................................. [ 54%] 1241s ........................................................................ [ 54%] 1242s ........................................................................ [ 54%] 1242s ........................................................................ [ 55%] 1243s ........................................................................ [ 55%] 1243s ........................................................................ [ 55%] 1246s ........................................................ [ 56%] 1246s tests/test_duck_array_wrapping.py s.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.sxss.s [ 56%] 1247s .ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.s.ssXsxss.sxss.sxss.sxss.s.ss.s.s [ 56%] 1248s sxsxssxsxssxsxss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.sxssxsxss.s.ss.s.ss. [ 57%] 1248s sxss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ssXsxss.s.ss.sxss.sx [ 57%] 1248s ss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss [ 57%] 1248s .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%] 1248s 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%] 1248s s.s.ss.s.ss.s.ss.s.s [ 58%] 1248s tests/test_error_messages.py .. [ 58%] 1248s tests/test_extensions.py .... [ 58%] 1249s tests/test_formatting.py ............................................... [ 58%] 1249s ..... [ 58%] 1249s tests/test_formatting_html.py ........................ [ 58%] 1250s tests/test_groupby.py ......................s........................... [ 59%] 1251s ...............................ss....................................... [ 59%] 1252s ........................................................................ [ 59%] 1253s .............................................................sssssssss.. [ 60%] 1254s ..s..............sssssssssss............. [ 60%] 1254s tests/test_hashable.py ........ [ 60%] 1254s tests/test_indexes.py .................................................. [ 60%] 1254s ........................ [ 60%] 1254s tests/test_indexing.py ................................................. [ 60%] 1254s ........................................................................ [ 61%] 1254s ............... [ 61%] 1263s tests/test_interp.py ................................................... [ 61%] 1268s .x...................................................................... [ 61%] 1282s ................................................................sss..sss [ 62%] 1296s ..sss..sss..sss..sss..sss..sss............... [ 62%] 1296s tests/test_merge.py .................................................... [ 62%] 1296s ... [ 62%] 1298s tests/test_missing.py .................................................. [ 62%] 1299s ..................s...........................................x.. [ 63%] 1299s tests/test_namedarray.py ....x...........................s.............. [ 63%] 1299s .. [ 63%] 1299s tests/test_nputils.py .. [ 63%] 1299s tests/test_options.py ................... [ 63%] 1300s tests/test_pandas_to_xarray.py xxxxxxxxxxxxxxxxxxxxxxxsxxxxxx........... [ 63%] 1300s ....................... [ 63%] 1300s tests/test_parallelcompat.py ............... [ 63%] 1302s tests/test_plot.py ..................................................... [ 63%] 1304s ........................................................................ [ 64%] 1309s ........................................................................ [ 64%] 1311s ...............................................s........................ [ 64%] 1315s .............X.......................................................x.. [ 65%] 1335s ss.ssss................................................................. [ 65%] 1336s .......sss.............................................................. [ 65%] 1336s .......................................... [ 66%] 1337s tests/test_plugins.py ............. [ 66%] 1337s tests/test_print_versions.py . [ 66%] 1340s tests/test_rolling.py .................................................. [ 66%] 1343s ........................................................................ [ 66%] 1345s ........................................................................ [ 67%] 1346s ........................................................................ [ 67%] 1348s ........................................................................ [ 67%] 1351s ........................................................................ [ 68%] 1351s ........................................................................ [ 68%] 1351s ........................................................................ [ 68%] 1352s ........................................................................ [ 69%] 1352s ........................................................................ [ 69%] 1354s ........................................................................ [ 69%] 1357s ........................................................................ [ 70%] 1360s ........................................................................ [ 70%] 1363s ........................................................................ [ 70%] 1363s ........................................................................ [ 71%] 1363s ........................................................................ [ 71%] 1363s ........................................................................ [ 71%] 1364s ........................................................................ [ 72%] 1367s ........................................................................ [ 72%] 1369s ........................................................................ [ 72%] 1372s ........................................................................ [ 73%] 1372s ........................................................................ [ 73%] 1373s ........................................................................ [ 73%] 1373s ........................................................................ [ 74%] 1374s ........................................................................ [ 74%] 1377s ........................................................................ [ 74%] 1380s ........................................................................ [ 75%] 1383s ........................................................................ [ 75%] 1384s ........................................................................ [ 75%] 1384s ........................................................................ [ 76%] 1384s ........................................................................ [ 76%] 1389s ........................................................................ [ 76%] 1391s ...........ssssssssssssssssssssssssssssssssssssssssss................... [ 77%] 1392s ........................................................................ [ 77%] 1392s ........................................................................ [ 77%] 1392s ........................................................................ [ 78%] 1393s ........................................................................ [ 78%] 1394s ........................................................................ [ 78%] 1394s ........................................................ssssssssssssssss [ 78%] 1395s ........................................................................ [ 79%] 1396s ........................................................................ [ 79%] 1396s ........................................................................ [ 79%] 1397s ........................................................................ [ 80%] 1401s ........................................................................ [ 80%] 1404s ........................................................................ [ 80%] 1407s ssssssssssssssss........................................................ [ 81%] 1410s ........................................................................ [ 81%] 1414s ........................................................................ [ 81%] 1417s ........................................................................ [ 82%] 1422s ........................................................................ [ 82%] 1422s ........sss [ 82%] 1436s tests/test_strategies.py ..................... [ 82%] 1436s tests/test_treenode.py .................................. [ 82%] 1447s tests/test_tutorial.py XXss [ 82%] 1447s tests/test_typed_ops.py ..... [ 82%] 1447s tests/test_ufuncs.py ................................................... [ 83%] 1447s .......................................................................x [ 83%] 1447s .. [ 83%] 1448s tests/test_units.py .s..s..s..s......sssssxxxxx.....sssss.xxxx.....sssss [ 83%] 1451s xxxxx.....sssss.xxxx.....sssssxxxxx.....sssss.xxxx.....sssssxxxxx.....ss [ 84%] 1453s sss.xxxx.........sssss..........sssss..........sssss..........sssss..... [ 84%] 1453s .....sssss..........sssss..........sssss..........sssss..........sssss.. [ 84%] 1454s ........sssss..........sssss..........sssss......s..s..s..s..s..s..s..s. [ 85%] 1454s .sx.sx.sx.sx............................................................ [ 85%] 1455s ........................................................................ [ 85%] 1455s ...................ssssssssss..........ssssssssss....................... [ 86%] 1455s ........................................................................ [ 86%] 1455s ...................................ss..XX............ss..XX............. [ 86%] 1455s ........................................................................ [ 87%] 1455s .....................s..s..ss....ss......ss..s.......................ss. [ 87%] 1455s .s...................................................................... [ 87%] 1463s ....x....x......................xxxxx.....xxxxx.x.x.x.x.x.x.x.x.x.x..... [ 88%] 1464s .xxxx................................................................... [ 88%] 1465s ...............x...............sssss.....sssssssssssssss.....sssss.....s [ 88%] 1465s ssssssssssssss.....sssss..........sssss..................s..s..s..s.ssss [ 89%] 1465s ss.s..s..s..s..s..s..s..s.ssssss.s..s..s..s...........ssssssssssssssssss [ 89%] 1465s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 89%] 1469s ........................................................xx..xx..ssssssss [ 90%] 1472s ssssssssssssxx..xx..ssssssssssssssssssss......ss....s......s..s.s.s.s.s. [ 90%] 1472s s...ss....ss....ss....ss....ss....ss....ss....ss...s..s..s.xs.sss.s..s.. [ 90%] 1473s s..s.xs.sss.s.....ss....ss....ss....ss....ss....ss....ss....ss.......sss [ 91%] 1473s ss..........sssss.......ss....ss........................................ [ 91%] 1474s ....................xxxx................................................ [ 91%] 1476s ..................................xx.....sssss.....sssss.....sssss.....s [ 92%] 1476s ssssssssssssss.....sssss.....sssssssssssssss.....sssss.....sssss........ [ 92%] 1476s .......sss...sssxx....s......s......ssssssssssssssssssssssssssssssssssss [ 92%] 1477s ssssssssssssssssssssssssssssssssssssssssssssssssssssss...sss......sss... [ 93%] 1480s ..................................................xx..xx..ssssssssssssss [ 93%] 1483s ssssssxx..xx..ssssssssssssssssssss............ssssssssssss.............. [ 93%] 1485s ..........ssssssssssss...............xx.ssssss...Xx....xx.ssssss...Xx..s [ 93%] 1486s ..s...........ssssssssss....................ssssssssss.................. [ 94%] 1486s s.....ssssssssssssss........s.............s.....ssssssssssssss........s. [ 94%] 1488s .........sssss..........sssss.......x.x.x.... [ 94%] 1488s tests/test_utils.py .................................................... [ 95%] 1488s .............. [ 95%] 1488s tests/test_variable.py ................................................. [ 95%] 1488s ........................................................................ [ 95%] 1488s ........................................................................ [ 96%] 1488s ........................................................................ [ 96%] 1490s ........................................................................ [ 96%] 1500s .................ssss...............x.xX.......xX.......xx.......xx..... [ 97%] 1501s ..xx.......s............................................................ [ 97%] 1501s ........................ssssssssssssssssssssssssssssssssssssssssssssssss [ 97%] 1502s sssssss..........................ssss....................... [ 97%] 1502s tests/test_weighted.py ................................................. [ 98%] 1502s ........................................................ssssssssssssssss [ 98%] 1503s ssssssssssssssssssssssssssssssssssssssssssssssssssssssss................ [ 98%] 1505s ........................................................................ [ 99%] 1506s ........................................................................ [ 99%] 1509s ........................................................................ [ 99%] 1511s ................................... [100%] 1511s 1511s =================================== FAILURES =================================== 1511s _________________ TestZarrDictStore.test_non_existent_store[2] _________________ 1511s 1511s self = 1511s 1511s def test_non_existent_store(self) -> None: 1511s with pytest.raises( 1511s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1511s ): 1511s > xr.open_zarr(f"{uuid.uuid4()}") 1511s 1511s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1511s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1511s ds = open_dataset( 1511s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1511s backend_ds = backend.open_dataset( 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1511s store = ZarrStore.open_group( 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1511s ) = _get_open_params( 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1511s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1511s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1511s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1511s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1511s raise return_result 1511s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1511s return await coro 1511s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1511s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1511s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1511s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1511s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1511s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1511s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1511s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1511s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1511s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1511s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1511s await store._open() 1511s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1511s 1511s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/9db3546f-cc1e-4cae-b3f3-a25b39d19950') 1511s 1511s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1511s if not self.read_only: 1511s self.root.mkdir(parents=True, exist_ok=True) 1511s 1511s if not self.root.exists(): 1511s > raise FileNotFoundError(f"{self.root} does not exist") 1511s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/9db3546f-cc1e-4cae-b3f3-a25b39d19950 does not exist 1511s 1511s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1511s 1511s During handling of the above exception, another exception occurred: 1511s 1511s self = 1511s 1511s def test_non_existent_store(self) -> None: 1511s > with pytest.raises( 1511s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1511s ): 1511s E AssertionError: Regex pattern did not match. 1511s E Regex: '(No such file or directory|Unable to find group)' 1511s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/9db3546f-cc1e-4cae-b3f3-a25b39d19950 does not exist' 1511s 1511s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1511s ______________ TestZarrDirectoryStore.test_non_existent_store[2] _______________ 1511s 1511s self = 1511s 1511s def test_non_existent_store(self) -> None: 1511s with pytest.raises( 1511s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1511s ): 1511s > xr.open_zarr(f"{uuid.uuid4()}") 1511s 1511s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1511s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1511s ds = open_dataset( 1511s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1511s backend_ds = backend.open_dataset( 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1511s store = ZarrStore.open_group( 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1511s ) = _get_open_params( 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1511s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1511s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1511s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1511s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1511s raise return_result 1511s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1511s return await coro 1511s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1511s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1511s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1511s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1511s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1511s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1511s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1511s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1511s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1511s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1511s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1511s await store._open() 1511s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1511s 1511s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/1a64dcc7-7b39-4cd9-9adb-84867feeec51') 1511s 1511s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1511s if not self.read_only: 1511s self.root.mkdir(parents=True, exist_ok=True) 1511s 1511s if not self.root.exists(): 1511s > raise FileNotFoundError(f"{self.root} does not exist") 1511s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/1a64dcc7-7b39-4cd9-9adb-84867feeec51 does not exist 1511s 1511s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1511s 1511s During handling of the above exception, another exception occurred: 1511s 1511s self = 1511s 1511s def test_non_existent_store(self) -> None: 1511s > with pytest.raises( 1511s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1511s ): 1511s E AssertionError: Regex pattern did not match. 1511s E Regex: '(No such file or directory|Unable to find group)' 1511s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/1a64dcc7-7b39-4cd9-9adb-84867feeec51 does not exist' 1511s 1511s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1511s ________________ TestZarrWriteEmpty.test_non_existent_store[2] _________________ 1511s 1511s self = 1511s 1511s def test_non_existent_store(self) -> None: 1511s with pytest.raises( 1511s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1511s ): 1511s > xr.open_zarr(f"{uuid.uuid4()}") 1511s 1511s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1511s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1511s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1511s ds = open_dataset( 1511s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1511s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1512s store = ZarrStore.open_group( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1512s ) = _get_open_params( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1512s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1512s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1512s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1512s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1512s raise return_result 1512s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1512s return await coro 1512s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1512s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1512s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1512s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1512s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1512s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1512s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1512s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1512s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1512s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1512s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1512s await store._open() 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/33335f73-8625-4446-a23b-682d1990450a') 1512s 1512s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1512s if not self.read_only: 1512s self.root.mkdir(parents=True, exist_ok=True) 1512s 1512s if not self.root.exists(): 1512s > raise FileNotFoundError(f"{self.root} does not exist") 1512s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/33335f73-8625-4446-a23b-682d1990450a does not exist 1512s 1512s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1512s 1512s During handling of the above exception, another exception occurred: 1512s 1512s self = 1512s 1512s def test_non_existent_store(self) -> None: 1512s > with pytest.raises( 1512s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1512s ): 1512s E AssertionError: Regex pattern did not match. 1512s E Regex: '(No such file or directory|Unable to find group)' 1512s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/33335f73-8625-4446-a23b-682d1990450a does not exist' 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1512s _______________ TestZarrWriteEmpty.test_write_empty[2-True-True] _______________ 1512s 1512s self = 1512s consolidated = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [True, False, None]) 1512s @pytest.mark.parametrize("write_empty", [True, False, None]) 1512s def test_write_empty( 1512s self, 1512s consolidated: bool | None, 1512s write_empty: bool | None, 1512s ) -> None: 1512s def assert_expected_files(expected: list[str], store: str) -> None: 1512s """Convenience for comparing with actual files written""" 1512s ls = [] 1512s test_root = os.path.join(store, "test") 1512s for root, _, files in os.walk(test_root): 1512s ls.extend( 1512s [ 1512s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1512s for f in files 1512s ] 1512s ) 1512s 1512s assert set(expected) == set( 1512s [ 1512s file.lstrip("c/") 1512s for file in ls 1512s if (file not in (".zattrs", ".zarray", "zarr.json")) 1512s ] 1512s ) 1512s 1512s # The zarr format is set by the `default_zarr_format` 1512s # pytest fixture that acts on a superclass 1512s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1512s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1512s expected = ["0.1.0"] 1512s else: 1512s expected = [ 1512s "0.0.0", 1512s "0.0.1", 1512s "0.1.0", 1512s "0.1.1", 1512s ] 1512s 1512s if zarr_format_3: 1512s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1512s # transform to the path style of zarr 3 1512s # e.g. 0/0/1 1512s expected = [e.replace(".", "/") for e in expected] 1512s else: 1512s # use nan for default fill_value behaviour 1512s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1512s 1512s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1512s 1512s if has_dask: 1512s ds["test"] = ds["test"].chunk(1) 1512s encoding = None 1512s else: 1512s encoding = {"test": {"chunks": (1, 1, 1)}} 1512s 1512s with self.temp_dir() as (d, store): 1512s ds.to_zarr( 1512s store, 1512s mode="w", 1512s encoding=encoding, 1512s write_empty_chunks=write_empty, 1512s ) 1512s 1512s # check expected files after a write 1512s assert_expected_files(expected, store) 1512s 1512s with self.roundtrip_dir( 1512s ds, 1512s store, 1512s save_kwargs={ 1512s "mode": "a", 1512s "append_dim": "Z", 1512s "write_empty_chunks": write_empty, 1512s }, 1512s ) as a_ds: 1512s expected_ds = xr.concat([ds, ds], dim="Z") 1512s 1512s assert_identical(a_ds, expected_ds.compute()) 1512s # add the new files we expect to be created by the append 1512s # that was performed by the roundtrip_dir 1512s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1512s expected.append("1.1.0") 1512s else: 1512s if not has_zarr_v3: 1512s # TODO: remove zarr3 if once zarr issue is fixed 1512s # https://github.com/zarr-developers/zarr-python/issues/2931 1512s expected.extend( 1512s [ 1512s "1.1.0", 1512s "1.0.0", 1512s "1.0.1", 1512s "1.1.1", 1512s ] 1512s ) 1512s else: 1512s expected.append("1.1.0") 1512s if zarr_format_3: 1512s expected = [e.replace(".", "/") for e in expected] 1512s > assert_expected_files(expected, store) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1512s store = '/tmp/tmpx5sjcqoc/test.zarr' 1512s 1512s def assert_expected_files(expected: list[str], store: str) -> None: 1512s """Convenience for comparing with actual files written""" 1512s ls = [] 1512s test_root = os.path.join(store, "test") 1512s for root, _, files in os.walk(test_root): 1512s ls.extend( 1512s [ 1512s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1512s for f in files 1512s ] 1512s ) 1512s 1512s > assert set(expected) == set( 1512s [ 1512s file.lstrip("c/") 1512s for file in ls 1512s if (file not in (".zattrs", ".zarray", "zarr.json")) 1512s ] 1512s ) 1512s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1512s E 1512s E Extra items in the right set: 1512s E '1.1.1' 1512s E '1.0.0' 1512s E '1.0.1' 1512s E Use -v to get more diff 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1512s ______________ TestZarrWriteEmpty.test_write_empty[2-True-False] _______________ 1512s 1512s self = 1512s consolidated = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [True, False, None]) 1512s @pytest.mark.parametrize("write_empty", [True, False, None]) 1512s def test_write_empty( 1512s self, 1512s consolidated: bool | None, 1512s write_empty: bool | None, 1512s ) -> None: 1512s def assert_expected_files(expected: list[str], store: str) -> None: 1512s """Convenience for comparing with actual files written""" 1512s ls = [] 1512s test_root = os.path.join(store, "test") 1512s for root, _, files in os.walk(test_root): 1512s ls.extend( 1512s [ 1512s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1512s for f in files 1512s ] 1512s ) 1512s 1512s assert set(expected) == set( 1512s [ 1512s file.lstrip("c/") 1512s for file in ls 1512s if (file not in (".zattrs", ".zarray", "zarr.json")) 1512s ] 1512s ) 1512s 1512s # The zarr format is set by the `default_zarr_format` 1512s # pytest fixture that acts on a superclass 1512s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1512s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1512s expected = ["0.1.0"] 1512s else: 1512s expected = [ 1512s "0.0.0", 1512s "0.0.1", 1512s "0.1.0", 1512s "0.1.1", 1512s ] 1512s 1512s if zarr_format_3: 1512s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1512s # transform to the path style of zarr 3 1512s # e.g. 0/0/1 1512s expected = [e.replace(".", "/") for e in expected] 1512s else: 1512s # use nan for default fill_value behaviour 1512s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1512s 1512s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1512s 1512s if has_dask: 1512s ds["test"] = ds["test"].chunk(1) 1512s encoding = None 1512s else: 1512s encoding = {"test": {"chunks": (1, 1, 1)}} 1512s 1512s with self.temp_dir() as (d, store): 1512s ds.to_zarr( 1512s store, 1512s mode="w", 1512s encoding=encoding, 1512s write_empty_chunks=write_empty, 1512s ) 1512s 1512s # check expected files after a write 1512s assert_expected_files(expected, store) 1512s 1512s with self.roundtrip_dir( 1512s ds, 1512s store, 1512s save_kwargs={ 1512s "mode": "a", 1512s "append_dim": "Z", 1512s "write_empty_chunks": write_empty, 1512s }, 1512s ) as a_ds: 1512s expected_ds = xr.concat([ds, ds], dim="Z") 1512s 1512s assert_identical(a_ds, expected_ds.compute()) 1512s # add the new files we expect to be created by the append 1512s # that was performed by the roundtrip_dir 1512s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1512s expected.append("1.1.0") 1512s else: 1512s if not has_zarr_v3: 1512s # TODO: remove zarr3 if once zarr issue is fixed 1512s # https://github.com/zarr-developers/zarr-python/issues/2931 1512s expected.extend( 1512s [ 1512s "1.1.0", 1512s "1.0.0", 1512s "1.0.1", 1512s "1.1.1", 1512s ] 1512s ) 1512s else: 1512s expected.append("1.1.0") 1512s if zarr_format_3: 1512s expected = [e.replace(".", "/") for e in expected] 1512s > assert_expected_files(expected, store) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1512s store = '/tmp/tmpib62ragn/test.zarr' 1512s 1512s def assert_expected_files(expected: list[str], store: str) -> None: 1512s """Convenience for comparing with actual files written""" 1512s ls = [] 1512s test_root = os.path.join(store, "test") 1512s for root, _, files in os.walk(test_root): 1512s ls.extend( 1512s [ 1512s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1512s for f in files 1512s ] 1512s ) 1512s 1512s > assert set(expected) == set( 1512s [ 1512s file.lstrip("c/") 1512s for file in ls 1512s if (file not in (".zattrs", ".zarray", "zarr.json")) 1512s ] 1512s ) 1512s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1512s E 1512s E Extra items in the right set: 1512s E '1.1.1' 1512s E '1.0.0' 1512s E '1.0.1' 1512s E Use -v to get more diff 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1512s _______________ TestZarrWriteEmpty.test_write_empty[2-True-None] _______________ 1512s 1512s self = 1512s consolidated = None, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [True, False, None]) 1512s @pytest.mark.parametrize("write_empty", [True, False, None]) 1512s def test_write_empty( 1512s self, 1512s consolidated: bool | None, 1512s write_empty: bool | None, 1512s ) -> None: 1512s def assert_expected_files(expected: list[str], store: str) -> None: 1512s """Convenience for comparing with actual files written""" 1512s ls = [] 1512s test_root = os.path.join(store, "test") 1512s for root, _, files in os.walk(test_root): 1512s ls.extend( 1512s [ 1512s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1512s for f in files 1512s ] 1512s ) 1512s 1512s assert set(expected) == set( 1512s [ 1512s file.lstrip("c/") 1512s for file in ls 1512s if (file not in (".zattrs", ".zarray", "zarr.json")) 1512s ] 1512s ) 1512s 1512s # The zarr format is set by the `default_zarr_format` 1512s # pytest fixture that acts on a superclass 1512s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1512s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1512s expected = ["0.1.0"] 1512s else: 1512s expected = [ 1512s "0.0.0", 1512s "0.0.1", 1512s "0.1.0", 1512s "0.1.1", 1512s ] 1512s 1512s if zarr_format_3: 1512s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1512s # transform to the path style of zarr 3 1512s # e.g. 0/0/1 1512s expected = [e.replace(".", "/") for e in expected] 1512s else: 1512s # use nan for default fill_value behaviour 1512s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1512s 1512s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1512s 1512s if has_dask: 1512s ds["test"] = ds["test"].chunk(1) 1512s encoding = None 1512s else: 1512s encoding = {"test": {"chunks": (1, 1, 1)}} 1512s 1512s with self.temp_dir() as (d, store): 1512s ds.to_zarr( 1512s store, 1512s mode="w", 1512s encoding=encoding, 1512s write_empty_chunks=write_empty, 1512s ) 1512s 1512s # check expected files after a write 1512s assert_expected_files(expected, store) 1512s 1512s with self.roundtrip_dir( 1512s ds, 1512s store, 1512s save_kwargs={ 1512s "mode": "a", 1512s "append_dim": "Z", 1512s "write_empty_chunks": write_empty, 1512s }, 1512s ) as a_ds: 1512s expected_ds = xr.concat([ds, ds], dim="Z") 1512s 1512s assert_identical(a_ds, expected_ds.compute()) 1512s # add the new files we expect to be created by the append 1512s # that was performed by the roundtrip_dir 1512s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1512s expected.append("1.1.0") 1512s else: 1512s if not has_zarr_v3: 1512s # TODO: remove zarr3 if once zarr issue is fixed 1512s # https://github.com/zarr-developers/zarr-python/issues/2931 1512s expected.extend( 1512s [ 1512s "1.1.0", 1512s "1.0.0", 1512s "1.0.1", 1512s "1.1.1", 1512s ] 1512s ) 1512s else: 1512s expected.append("1.1.0") 1512s if zarr_format_3: 1512s expected = [e.replace(".", "/") for e in expected] 1512s > assert_expected_files(expected, store) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1512s store = '/tmp/tmpm2ibnmxq/test.zarr' 1512s 1512s def assert_expected_files(expected: list[str], store: str) -> None: 1512s """Convenience for comparing with actual files written""" 1512s ls = [] 1512s test_root = os.path.join(store, "test") 1512s for root, _, files in os.walk(test_root): 1512s ls.extend( 1512s [ 1512s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1512s for f in files 1512s ] 1512s ) 1512s 1512s > assert set(expected) == set( 1512s [ 1512s file.lstrip("c/") 1512s for file in ls 1512s if (file not in (".zattrs", ".zarray", "zarr.json")) 1512s ] 1512s ) 1512s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1512s E 1512s E Extra items in the right set: 1512s E '1.1.1' 1512s E '1.0.0' 1512s E '1.0.1' 1512s E Use -v to get more diff 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1512s _____________ TestZarrDictStore.test_zero_dimensional_variable[3] ______________ 1512s 1512s self = 1512s 1512s def test_zero_dimensional_variable(self) -> None: 1512s expected = create_test_data() 1512s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1512s expected["bytes_var"] = ([], b"foobar") 1512s expected["string_var"] = ([], "foobar") 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________________ TestZarrDictStore.test_write_store[3] _____________________ 1512s 1512s self = 1512s 1512s def test_write_store(self) -> None: 1512s expected = create_test_data() 1512s with self.create_store() as store: 1512s expected.dump_to_store(store) 1512s # we need to cf decode the store because it has time and 1512s # non-dimension coordinates 1512s > with xr.decode_cf(store) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1512s vars, attrs = obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_roundtrip_test_data[3] _________________ 1512s 1512s self = 1512s 1512s def test_roundtrip_test_data(self) -> None: 1512s expected = create_test_data() 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________________ TestZarrDictStore.test_load[3] ________________________ 1512s 1512s self = 1512s 1512s def test_load(self) -> None: 1512s expected = create_test_data() 1512s 1512s @contextlib.contextmanager 1512s def assert_loads(vars=None): 1512s if vars is None: 1512s vars = expected 1512s with self.roundtrip(expected) as actual: 1512s for k, v in actual.variables.items(): 1512s # IndexVariables are eagerly loaded into memory 1512s assert v._in_memory == (k in actual.dims) 1512s yield actual 1512s for k, v in actual.variables.items(): 1512s if k in vars: 1512s assert v._in_memory 1512s assert_identical(expected, actual) 1512s 1512s with pytest.raises(AssertionError): 1512s # make sure the contextmanager works! 1512s > with assert_loads() as ds: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1512s with self.roundtrip(expected) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________________ TestZarrDictStore.test_dataset_compute[3] ___________________ 1512s 1512s self = 1512s 1512s def test_dataset_compute(self) -> None: 1512s expected = create_test_data() 1512s 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______________ TestZarrDictStore.test_roundtrip_object_dtype[3] _______________ 1512s 1512s self = 1512s 1512s def test_roundtrip_object_dtype(self) -> None: 1512s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1512s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1512s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1512s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1512s strings = np.array(["ab", "cdef", "g"], dtype=object) 1512s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1512s all_nans = np.array([np.nan, np.nan], dtype=object) 1512s original = Dataset( 1512s { 1512s "floats": ("a", floats), 1512s "floats_nans": ("a", floats_nans), 1512s "bytes": ("b", bytes_), 1512s "bytes_nans": ("b", bytes_nans), 1512s "strings": ("b", strings), 1512s "strings_nans": ("b", strings_nans), 1512s "all_nans": ("c", all_nans), 1512s "nan": ([], np.nan), 1512s } 1512s ) 1512s expected = original.copy(deep=True) 1512s > with self.roundtrip(original) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'nan' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______________ TestZarrDictStore.test_roundtrip_float64_data[3] _______________ 1512s 1512s self = 1512s 1512s def test_roundtrip_float64_data(self) -> None: 1512s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_orthogonal_indexing[3] _________________ 1512s 1512s self = 1512s 1512s def test_orthogonal_indexing(self) -> None: 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_vectorized_indexing[3] _________________ 1512s 1512s self = 1512s 1512s def test_vectorized_indexing(self) -> None: 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_vectorized_indexing_negative_step[3] __________ 1512s 1512s self = 1512s 1512s def test_vectorized_indexing_negative_step(self) -> None: 1512s # use dask explicitly when present 1512s open_kwargs: dict[str, Any] | None 1512s if has_dask: 1512s open_kwargs = {"chunks": {}} 1512s else: 1512s open_kwargs = None 1512s in_memory = create_test_data() 1512s 1512s def multiple_indexing(indexers): 1512s # make sure a sequence of lazy indexings certainly works. 1512s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1512s actual = on_disk["var3"] 1512s expected = in_memory["var3"] 1512s for ind in indexers: 1512s actual = actual.isel(ind) 1512s expected = expected.isel(ind) 1512s # make sure the array is not yet loaded into memory 1512s assert not actual.variable._in_memory 1512s assert_identical(expected, actual.load()) 1512s 1512s # with negative step slice. 1512s indexers = [ 1512s { 1512s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1512s "dim3": slice(-1, 1, -1), 1512s } 1512s ] 1512s > multiple_indexing(indexers) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1512s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDictStore.test_outer_indexing_reversed[3] _______________ 1512s 1512s self = 1512s 1512s def test_outer_indexing_reversed(self) -> None: 1512s # regression test for GH6560 1512s ds = xr.Dataset( 1512s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1512s ) 1512s 1512s > with self.roundtrip(ds) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'z' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________________ TestZarrDictStore.test_isel_dataarray[3] ___________________ 1512s 1512s self = 1512s 1512s def test_isel_dataarray(self) -> None: 1512s # Make sure isel works lazily. GH:issue:1688 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _____________ TestZarrDictStore.test_array_type_after_indexing[3] ______________ 1512s 1512s self = 1512s 1512s def test_array_type_after_indexing(self) -> None: 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______________________ TestZarrDictStore.test_dropna[3] _______________________ 1512s 1512s self = 1512s 1512s def test_dropna(self) -> None: 1512s # regression test for GH:issue:1694 1512s a = np.random.randn(4, 3) 1512s a[1, 1] = np.nan 1512s in_memory = xr.Dataset( 1512s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1512s ) 1512s 1512s assert_identical( 1512s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1512s ) 1512s 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'a' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________________ TestZarrDictStore.test_ondisk_after_print[3] _________________ 1512s 1512s self = 1512s 1512s def test_ondisk_after_print(self) -> None: 1512s """Make sure print does not load file into memory""" 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDictStore.test_roundtrip_bytes_with_fill_value[3] ___________ 1512s 1512s self = 1512s 1512s def test_roundtrip_bytes_with_fill_value(self) -> None: 1512s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1512s encoding = {"_FillValue": b"X", "dtype": "S1"} 1512s original = Dataset({"x": ("t", values, {}, encoding)}) 1512s expected = original.copy(deep=True) 1512s > with self.roundtrip(original) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value0-False] ________ 1512s 1512s self = 1512s fill_value = np.int8(-1), exp_fill_warning = False 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value1-True] _________ 1512s 1512s self = 1512s fill_value = np.uint8(255), exp_fill_warning = True 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDictStore.test_roundtrip_unsigned[3--1-False] _____________ 1512s 1512s self = 1512s fill_value = -1, exp_fill_warning = False 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDictStore.test_roundtrip_unsigned[3-255-True] _____________ 1512s 1512s self = 1512s fill_value = 255, exp_fill_warning = True 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1512s 1512s self = 1512s 1512s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1512s original = self._create_cf_dataset() 1512s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = 1512s name = 'det_lim' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____ TestZarrDictStore.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1512s 1512s self = 1512s 1512s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1512s original = self._create_cf_dataset() 1512s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = 1512s name = 'det_lim' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1512s 1512s self = 1512s 1512s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1512s self, 1512s ) -> None: 1512s original = self._create_cf_dataset() 1512s # The DataArray roundtrip should have the same warnings as the 1512s # Dataset, but we already tested for those, so just go for the 1512s # new warnings. It would appear that there is no way to tell 1512s # pytest "This warning and also this warning should both be 1512s # present". 1512s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1512s # needs the to_dataset. The other backends should be fine 1512s # without it. 1512s with pytest.warns( 1512s UserWarning, 1512s match=( 1512s r"Variable\(s\) referenced in bounds not in variables: " 1512s r"\['l(at|ong)itude_bnds'\]" 1512s ), 1512s ): 1512s > with self.roundtrip( 1512s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'ln_p' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s 1512s During handling of the above exception, another exception occurred: 1512s 1512s self = 1512s 1512s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1512s self, 1512s ) -> None: 1512s original = self._create_cf_dataset() 1512s # The DataArray roundtrip should have the same warnings as the 1512s # Dataset, but we already tested for those, so just go for the 1512s # new warnings. It would appear that there is no way to tell 1512s # pytest "This warning and also this warning should both be 1512s # present". 1512s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1512s # needs the to_dataset. The other backends should be fine 1512s # without it. 1512s > with pytest.warns( 1512s UserWarning, 1512s match=( 1512s r"Variable\(s\) referenced in bounds not in variables: " 1512s r"\['l(at|ong)itude_bnds'\]" 1512s ), 1512s ): 1512s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1512s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1512s 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.')]. 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1512s ___________________ TestZarrDictStore.test_encoding_kwarg[3] ___________________ 1512s 1512s self = 1512s 1512s def test_encoding_kwarg(self) -> None: 1512s ds = Dataset({"x": ("y", np.arange(10.0))}) 1512s 1512s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1512s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float32' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________________ TestZarrDictStore.test_default_fill_value[3] _________________ 1512s 1512s self = 1512s 1512s def test_default_fill_value(self) -> None: 1512s # Test default encoding for float: 1512s ds = Dataset({"x": ("y", np.arange(10.0))}) 1512s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1512s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float32' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord[3] _________ 1512s 1512s self = 1512s 1512s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1512s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1512s ds.y.encoding["_FillValue"] = None 1512s > with self.roundtrip(ds) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1512s 1512s self = 1512s 1512s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1512s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1512s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1512s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_encoding_same_dtype[3] _________________ 1512s 1512s self = 1512s 1512s def test_encoding_same_dtype(self) -> None: 1512s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1512s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1512s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float32' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDictStore.test_append_overwrite_values[3] _______________ 1512s 1512s self = 1512s 1512s def test_append_overwrite_values(self) -> None: 1512s # regression for GH1215 1512s data = create_test_data() 1512s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1512s self.save(data, tmp_file, mode="w") 1512s data["var2"][:] = -999 1512s data["var9"] = data["var2"] * 3 1512s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1512s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-False] ____________ 1512s 1512s self = 1512s consolidated = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s def test_roundtrip_consolidated(self, consolidated) -> None: 1512s expected = create_test_data() 1512s > with self.roundtrip( 1512s expected, 1512s save_kwargs={"consolidated": consolidated}, 1512s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-True] _____________ 1512s 1512s self = 1512s consolidated = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s def test_roundtrip_consolidated(self, consolidated) -> None: 1512s expected = create_test_data() 1512s > with self.roundtrip( 1512s expected, 1512s save_kwargs={"consolidated": consolidated}, 1512s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-None] _____________ 1512s 1512s self = 1512s consolidated = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s def test_roundtrip_consolidated(self, consolidated) -> None: 1512s expected = create_test_data() 1512s > with self.roundtrip( 1512s expected, 1512s save_kwargs={"consolidated": consolidated}, 1512s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________ TestZarrDictStore.test_read_non_consolidated_warning[3] ____________ 1512s 1512s self = 1512s 1512s def test_read_non_consolidated_warning(self) -> None: 1512s expected = create_test_data() 1512s with self.create_zarr_target() as store: 1512s self.save( 1512s expected, store_target=store, consolidated=False, **self.version_kwargs 1512s ) 1512s with pytest.warns( 1512s RuntimeWarning, 1512s match="Failed to open Zarr store with consolidated", 1512s ): 1512s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________________ TestZarrDictStore.test_non_existent_store[3] _________________ 1512s 1512s self = 1512s 1512s def test_non_existent_store(self) -> None: 1512s with pytest.raises( 1512s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1512s ): 1512s > xr.open_zarr(f"{uuid.uuid4()}") 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1512s store = ZarrStore.open_group( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1512s ) = _get_open_params( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1512s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1512s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1512s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1512s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1512s raise return_result 1512s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1512s return await coro 1512s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1512s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1512s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1512s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1512s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1512s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1512s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1512s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1512s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1512s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1512s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1512s await store._open() 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/3b1851ca-41a1-4638-ade5-70efe3a8aaf0') 1512s 1512s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1512s if not self.read_only: 1512s self.root.mkdir(parents=True, exist_ok=True) 1512s 1512s if not self.root.exists(): 1512s > raise FileNotFoundError(f"{self.root} does not exist") 1512s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/3b1851ca-41a1-4638-ade5-70efe3a8aaf0 does not exist 1512s 1512s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1512s 1512s During handling of the above exception, another exception occurred: 1512s 1512s self = 1512s 1512s def test_non_existent_store(self) -> None: 1512s > with pytest.raises( 1512s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1512s ): 1512s E AssertionError: Regex pattern did not match. 1512s E Regex: '(No such file or directory|Unable to find group)' 1512s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/3b1851ca-41a1-4638-ade5-70efe3a8aaf0 does not exist' 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1512s _____________________ TestZarrDictStore.test_auto_chunk[3] _____________________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_auto_chunk(self) -> None: 1512s original = create_test_data().chunk() 1512s 1512s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________________ TestZarrDictStore.test_manual_chunk[3] ____________________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1512s def test_manual_chunk(self) -> None: 1512s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1512s 1512s # Using chunks = None should return non-chunked arrays 1512s open_kwargs: dict[str, Any] = {"chunks": None} 1512s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______________ TestZarrDictStore.test_warning_on_bad_chunks[3] ________________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_warning_on_bad_chunks(self) -> None: 1512s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1512s 1512s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1512s for chunks in bad_chunks: 1512s kwargs = {"chunks": chunks} 1512s with pytest.warns(UserWarning): 1512s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDictStore.test_write_uneven_dask_chunks[3] ______________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_write_uneven_dask_chunks(self) -> None: 1512s # regression for GH#2225 1512s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1512s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________________ TestZarrDictStore.test_chunk_encoding[3] ___________________ 1512s 1512s self = 1512s 1512s def test_chunk_encoding(self) -> None: 1512s # These datasets have no dask chunks. All chunking specified in 1512s # encoding 1512s data = create_test_data() 1512s chunks = (5, 5) 1512s data["var2"].encoding.update({"chunks": chunks}) 1512s 1512s > with self.roundtrip(data) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________________ TestZarrDictStore.test_shard_encoding[3] ___________________ 1512s 1512s self = 1512s 1512s def test_shard_encoding(self) -> None: 1512s # These datasets have no dask chunks. All chunking/sharding specified in 1512s # encoding 1512s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1512s data = create_test_data() 1512s chunks = (1, 1) 1512s shards = (5, 5) 1512s data["var2"].encoding.update({"chunks": chunks}) 1512s data["var2"].encoding.update({"shards": shards}) 1512s > with self.roundtrip(data) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDictStore.test_write_persistence_modes[3-None] ____________ 1512s 1512s self = 1512s group = None 1512s 1512s @pytest.mark.parametrize("group", [None, "group1"]) 1512s def test_write_persistence_modes(self, group) -> None: 1512s original = create_test_data() 1512s 1512s # overwrite mode 1512s > with self.roundtrip( 1512s original, 1512s save_kwargs={"mode": "w", "group": group}, 1512s open_kwargs={"group": group}, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________ TestZarrDictStore.test_write_persistence_modes[3-group1] ___________ 1512s 1512s self = 1512s group = 'group1' 1512s 1512s @pytest.mark.parametrize("group", [None, "group1"]) 1512s def test_write_persistence_modes(self, group) -> None: 1512s original = create_test_data() 1512s 1512s # overwrite mode 1512s > with self.roundtrip( 1512s original, 1512s save_kwargs={"mode": "w", "group": group}, 1512s open_kwargs={"group": group}, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_compressor_encoding[3] _________________ 1512s 1512s self = 1512s 1512s def test_compressor_encoding(self) -> None: 1512s # specify a custom compressor 1512s original = create_test_data() 1512s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1512s encoding_key = "compressors" 1512s # all parameters need to be explicitly specified in order for the comparison to pass below 1512s encoding = { 1512s "serializer": zarr.codecs.BytesCodec(endian="little"), 1512s encoding_key: ( 1512s zarr.codecs.BloscCodec( 1512s cname="zstd", 1512s clevel=3, 1512s shuffle="shuffle", 1512s typesize=8, 1512s blocksize=0, 1512s ), 1512s ), 1512s } 1512s else: 1512s from numcodecs.blosc import Blosc 1512s 1512s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1512s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1512s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1512s 1512s save_kwargs = dict(encoding={"var1": encoding}) 1512s 1512s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______________________ TestZarrDictStore.test_group[3] ________________________ 1512s 1512s self = 1512s 1512s def test_group(self) -> None: 1512s original = create_test_data() 1512s group = "some/random/path" 1512s > with self.roundtrip( 1512s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________________ TestZarrDictStore.test_append_write[3] ____________________ 1512s 1512s self = 1512s 1512s def test_append_write(self) -> None: 1512s > super().test_append_write() 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1512s with self.roundtrip_append(data) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1512s self.save(data[[key]], path, mode=mode, **save_kwargs) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1512s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______ TestZarrDictStore.test_append_with_append_dim_not_set_raises[3] ________ 1512s 1512s self = 1512s 1512s def test_append_with_append_dim_not_set_raises(self) -> None: 1512s ds, ds_to_append, _ = create_append_test_data() 1512s with self.create_zarr_target() as store_target: 1512s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1512s with pytest.raises(ValueError, match="different dimension sizes"): 1512s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'da' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-U] ________ 1512s 1512s self = 1512s dtype = 'U' 1512s 1512s @pytest.mark.parametrize("dtype", ["U", "S"]) 1512s def test_append_string_length_mismatch_works(self, dtype) -> None: 1512s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1512s # ...but it probably would if we used object dtype 1512s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1512s expected = xr.concat([ds, ds_to_append], dim="time") 1512s with self.create_zarr_target() as store_target: 1512s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1512s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1512s _validate_datatypes_for_zarr_append( 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s vname = 'temperature' 1512s existing_var = Size: 96B 1512s [3 values with dtype=>U8] 1512s new_var = Size: 60B 1512s array(['abc', 'def', 'ghijk'], dtype='>U5') 1512s 1512s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1512s """If variable exists in the store, confirm dtype of the data to append is compatible with 1512s existing dtype. 1512s """ 1512s if ( 1512s np.issubdtype(new_var.dtype, np.number) 1512s or np.issubdtype(new_var.dtype, np.datetime64) 1512s or np.issubdtype(new_var.dtype, np.bool_) 1512s or new_var.dtype == object 1512s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1512s ): 1512s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1512s # new to the dataset, because in this case there is no existing var to compare it to; 1512s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1512s # we can be confident appending won't cause problems. Examples of dtypes which are not 1512s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1512s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1512s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1512s f"dataset to append has dtype {new_var.dtype}." 1512s ) 1512s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype >U8 but dataset to append has dtype >U5. 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1512s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-S] ________ 1512s 1512s self = 1512s dtype = 'S' 1512s 1512s @pytest.mark.parametrize("dtype", ["U", "S"]) 1512s def test_append_string_length_mismatch_works(self, dtype) -> None: 1512s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1512s # ...but it probably would if we used object dtype 1512s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1512s expected = xr.concat([ds, ds_to_append], dim="time") 1512s with self.create_zarr_target() as store_target: 1512s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1512s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1512s _validate_datatypes_for_zarr_append( 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s vname = 'temperature' 1512s existing_var = Size: 6B 1512s [3 values with dtype=|S2] 1512s new_var = Size: 9B 1512s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1512s 1512s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1512s """If variable exists in the store, confirm dtype of the data to append is compatible with 1512s existing dtype. 1512s """ 1512s if ( 1512s np.issubdtype(new_var.dtype, np.number) 1512s or np.issubdtype(new_var.dtype, np.datetime64) 1512s or np.issubdtype(new_var.dtype, np.bool_) 1512s or new_var.dtype == object 1512s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1512s ): 1512s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1512s # new to the dataset, because in this case there is no existing var to compare it to; 1512s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1512s # we can be confident appending won't cause problems. Examples of dtypes which are not 1512s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1512s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1512s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1512s f"dataset to append has dtype {new_var.dtype}." 1512s ) 1512s 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. 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1512s _____ TestZarrDictStore.test_check_encoding_is_consistent_after_append[3] ______ 1512s 1512s self = 1512s 1512s def test_check_encoding_is_consistent_after_append(self) -> None: 1512s ds, ds_to_append, _ = create_append_test_data() 1512s 1512s # check encoding consistency 1512s with self.create_zarr_target() as store_target: 1512s import numcodecs 1512s 1512s encoding_value: Any 1512s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1512s compressor = zarr.codecs.BloscCodec() 1512s else: 1512s compressor = numcodecs.Blosc() 1512s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1512s encoding_value = (compressor,) if has_zarr_v3 else compressor 1512s 1512s encoding = {"da": {encoding_key: encoding_value}} 1512s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1512s > original_ds = xr.open_dataset( 1512s store_target, engine="zarr", **self.version_kwargs 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'da' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDictStore.test_append_with_new_variable[3] ______________ 1512s 1512s self = 1512s 1512s def test_append_with_new_variable(self) -> None: 1512s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1512s 1512s # check append mode for new variable 1512s with self.create_zarr_target() as store_target: 1512s combined = xr.concat([ds, ds_to_append], dim="time") 1512s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1512s assert_identical( 1512s combined, 1512s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'da' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_append_with_append_dim_no_overwrite[3] _________ 1512s 1512s self = 1512s 1512s def test_append_with_append_dim_no_overwrite(self) -> None: 1512s ds, ds_to_append, _ = create_append_test_data() 1512s with self.create_zarr_target() as store_target: 1512s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1512s original = xr.concat([ds, ds_to_append], dim="time") 1512s original2 = xr.concat([original, ds_to_append], dim="time") 1512s 1512s # overwrite a coordinate; 1512s # for mode='a-', this will not get written to the store 1512s # because it does not have the append_dim as a dim 1512s lon = ds_to_append.lon.to_numpy().copy() 1512s lon[:] = -999 1512s ds_to_append["lon"] = lon 1512s > ds_to_append.to_zarr( 1512s store_target, mode="a-", append_dim="time", **self.version_kwargs 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'da' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDictStore.test_to_zarr_compute_false_roundtrip[3] ___________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_to_zarr_compute_false_roundtrip(self) -> None: 1512s from dask.delayed import Delayed 1512s 1512s original = create_test_data().chunk() 1512s 1512s with self.create_zarr_target() as store: 1512s delayed_obj = self.save(original, store, compute=False) 1512s assert isinstance(delayed_obj, Delayed) 1512s 1512s # make sure target store has not been written to yet 1512s with pytest.raises(AssertionError): 1512s > with self.open(store) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______ TestZarrDictStore.test_to_zarr_append_compute_false_roundtrip[3] _______ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1512s from dask.delayed import Delayed 1512s 1512s ds, ds_to_append, _ = create_append_test_data() 1512s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1512s 1512s with pytest.warns(SerializationWarning): 1512s with self.create_zarr_target() as store: 1512s delayed_obj = self.save(ds, store, compute=False, mode="w") 1512s assert isinstance(delayed_obj, Delayed) 1512s 1512s with pytest.raises(AssertionError): 1512s > with self.open(store) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'da' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_save_emptydim[3-False] _________________ 1512s 1512s self = 1512s chunk = False 1512s 1512s @pytest.mark.parametrize("chunk", [False, True]) 1512s def test_save_emptydim(self, chunk) -> None: 1512s if chunk and not has_dask: 1512s pytest.skip("requires dask") 1512s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1512s if chunk: 1512s ds = ds.chunk({}) # chunk dataset to save dask array 1512s > with self.roundtrip(ds) as ds_reload: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________________ TestZarrDictStore.test_save_emptydim[3-True] _________________ 1512s 1512s self = 1512s chunk = True 1512s 1512s @pytest.mark.parametrize("chunk", [False, True]) 1512s def test_save_emptydim(self, chunk) -> None: 1512s if chunk and not has_dask: 1512s pytest.skip("requires dask") 1512s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1512s if chunk: 1512s ds = ds.chunk({}) # chunk dataset to save dask array 1512s > with self.roundtrip(ds) as ds_reload: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _____ TestZarrDictStore.test_no_warning_from_open_emptydim_with_chunks[3] ______ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1512s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1512s with assert_no_warnings(): 1512s with warnings.catch_warnings(): 1512s warnings.filterwarnings( 1512s "ignore", 1512s message=".*Zarr format 3 specification.*", 1512s category=UserWarning, 1512s ) 1512s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-False-False-False-False] ________ 1512s 1512s self = 1512s consolidated = False, compute = False, use_dask = False, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-False-False-False-True] _________ 1512s 1512s self = 1512s consolidated = True, compute = False, use_dask = False, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-False-False-False-None] _________ 1512s 1512s self = 1512s consolidated = None, compute = False, use_dask = False, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-False-False-True-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = True, use_dask = False, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-False-True-True] _________ 1512s 1512s self = 1512s consolidated = True, compute = True, use_dask = False, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-False-True-None] _________ 1512s 1512s self = 1512s consolidated = None, compute = True, use_dask = False, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-False-True-False-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = False, use_dask = True, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-True-False-True] _________ 1512s 1512s self = 1512s consolidated = True, compute = False, use_dask = True, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-True-False-None] _________ 1512s 1512s self = 1512s consolidated = None, compute = False, use_dask = True, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-True-True-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = True, use_dask = True, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-True-True-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = True, use_dask = True, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-False-True-True-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = True, use_dask = True, write_empty = False 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-True-False-False-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = False, use_dask = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-False-False-True] _________ 1512s 1512s self = 1512s consolidated = True, compute = False, use_dask = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-False-False-None] _________ 1512s 1512s self = 1512s consolidated = None, compute = False, use_dask = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-False-True-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = True, use_dask = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-False-True-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = True, use_dask = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-False-True-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = True, use_dask = False, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-True-False-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = False, use_dask = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-True-False-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = False, use_dask = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-True-False-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = False, use_dask = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-True-True-True-False] __________ 1512s 1512s self = 1512s consolidated = False, compute = True, use_dask = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDictStore.test_write_region[3-True-True-True-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = True, use_dask = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDictStore.test_write_region[3-True-True-True-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = True, use_dask = True, write_empty = True 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_region[3-None-False-False-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = False, use_dask = False, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-False-False-True] _________ 1512s 1512s self = 1512s consolidated = True, compute = False, use_dask = False, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-False-False-None] _________ 1512s 1512s self = 1512s consolidated = None, compute = False, use_dask = False, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-False-True-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = True, use_dask = False, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-False-True-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = True, use_dask = False, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-False-True-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = True, use_dask = False, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-True-False-False] _________ 1512s 1512s self = 1512s consolidated = False, compute = False, use_dask = True, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-True-False-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = False, use_dask = True, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-True-False-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = False, use_dask = True, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s assert_identical(actual, zeros) 1512s for i in range(0, 10, 2): 1512s region = {"x": slice(i, i + 2)} 1512s > nonzeros.isel(region).to_zarr( 1512s store, 1512s region=region, 1512s consolidated=consolidated, 1512s write_empty_chunks=write_empty, 1512s **self.version_kwargs, 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _________ TestZarrDictStore.test_write_region[3-None-True-True-False] __________ 1512s 1512s self = 1512s consolidated = False, compute = True, use_dask = True, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDictStore.test_write_region[3-None-True-True-True] __________ 1512s 1512s self = 1512s consolidated = True, compute = True, use_dask = True, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDictStore.test_write_region[3-None-True-True-None] __________ 1512s 1512s self = 1512s consolidated = None, compute = True, use_dask = True, write_empty = None 1512s 1512s @pytest.mark.parametrize("consolidated", [False, True, None]) 1512s @pytest.mark.parametrize("compute", [False, True]) 1512s @pytest.mark.parametrize("use_dask", [False, True]) 1512s @pytest.mark.parametrize("write_empty", [False, True, None]) 1512s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1512s if (use_dask or not compute) and not has_dask: 1512s pytest.skip("requires dask") 1512s 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s 1512s if use_dask: 1512s zeros = zeros.chunk(2) 1512s nonzeros = nonzeros.chunk(2) 1512s 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr( 1512s store, 1512s consolidated=consolidated, 1512s compute=compute, 1512s encoding={"u": dict(chunks=2)}, 1512s **self.version_kwargs, 1512s ) 1512s if compute: 1512s > with xr.open_zarr( 1512s store, consolidated=consolidated, **self.version_kwargs 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______________ TestZarrDictStore.test_write_region_mode[3-None] _______________ 1512s 1512s self = 1512s mode = None 1512s 1512s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1512s def test_write_region_mode(self, mode) -> None: 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr(store, **self.version_kwargs) 1512s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1512s > nonzeros.isel(region).to_zarr( 1512s store, region=region, mode=mode, **self.version_kwargs 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_write_region_mode[3-r+] ________________ 1512s 1512s self = 1512s mode = 'r+' 1512s 1512s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1512s def test_write_region_mode(self, mode) -> None: 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr(store, **self.version_kwargs) 1512s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1512s > nonzeros.isel(region).to_zarr( 1512s store, region=region, mode=mode, **self.version_kwargs 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_write_region_mode[3-a] _________________ 1512s 1512s self = 1512s mode = 'a' 1512s 1512s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1512s def test_write_region_mode(self, mode) -> None: 1512s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1512s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1512s with self.create_zarr_target() as store: 1512s zeros.to_zarr(store, **self.version_kwargs) 1512s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1512s > nonzeros.isel(region).to_zarr( 1512s store, region=region, mode=mode, **self.version_kwargs 1512s ) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDictStore.test_write_preexisting_override_metadata[3] _________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_write_preexisting_override_metadata(self) -> None: 1512s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1512s original = Dataset( 1512s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1512s attrs={"global": "original"}, 1512s ) 1512s both_modified = Dataset( 1512s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1512s attrs={"global": "modified"}, 1512s ) 1512s global_modified = Dataset( 1512s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1512s attrs={"global": "modified"}, 1512s ) 1512s only_new_data = Dataset( 1512s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1512s attrs={"global": "original"}, 1512s ) 1512s 1512s with self.create_zarr_target() as store: 1512s original.to_zarr(store, compute=False, **self.version_kwargs) 1512s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1512s return to_zarr( # type: ignore[call-overload,misc] 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1512s dump_to_store(dataset, zstore, writer, encoding=encoding) 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1512s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1512s k: self.open_store_variable(name=k) for k in existing_variable_names 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'u' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_encoding_chunksizes[3] _________________ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_encoding_chunksizes(self) -> None: 1512s # regression test for GH2278 1512s # see also test_encoding_chunksizes_unlimited 1512s nx, ny, nt = 4, 4, 5 1512s original = xr.Dataset( 1512s {}, 1512s coords={ 1512s "x": np.arange(nx), 1512s "y": np.arange(ny), 1512s "t": np.arange(nt), 1512s }, 1512s ) 1512s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1512s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1512s 1512s > with self.roundtrip(original) as ds1: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'v' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______ TestZarrDictStore.test_chunk_encoding_with_partial_dask_chunks[3] _______ 1512s 1512s self = 1512s 1512s @requires_dask 1512s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1512s original = xr.Dataset( 1512s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1512s ).chunk({"a": 3}) 1512s 1512s > with self.roundtrip( 1512s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1512s ) as ds1: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDictStore.test_open_zarr_use_cftime[3] ________________ 1512s 1512s self = 1512s 1512s @requires_cftime 1512s def test_open_zarr_use_cftime(self) -> None: 1512s ds = create_test_data() 1512s with self.create_zarr_target() as store_target: 1512s ds.to_zarr(store_target, **self.version_kwargs) 1512s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDictStore.test_write_read_select_write[3] _______________ 1512s 1512s self = 1512s 1512s def test_write_read_select_write(self) -> None: 1512s # Test for https://github.com/pydata/xarray/issues/4084 1512s ds = create_test_data() 1512s 1512s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1512s with self.create_zarr_target() as initial_store: 1512s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1512s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________________ TestZarrDictStore.test_attributes[3-obj1] ___________________ 1512s 1512s self = 1512s obj = Size: 8B 1512s array(nan) 1512s Attributes: 1512s good: {'key': 'value'} 1512s 1512s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1512s def test_attributes(self, obj) -> None: 1512s obj = obj.copy() 1512s 1512s obj.attrs["good"] = {"key": "value"} 1512s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1512s with self.create_zarr_target() as store_target: 1512s ds.to_zarr(store_target, **self.version_kwargs) 1512s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1512s ds = open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'foo' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1512s 1512s self = 1512s dtype = 'datetime64[ns]' 1512s 1512s @requires_dask 1512s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1512s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1512s # Generalized from @malmans2's test in PR #8253 1512s original = create_test_data().astype(dtype).chunk(1) 1512s > with self.roundtrip( 1512s original, 1512s open_kwargs={ 1512s "chunks": {}, 1512s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1512s }, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] __ 1512s 1512s self = 1512s dtype = 'timedelta64[ns]' 1512s 1512s @requires_dask 1512s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1512s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1512s # Generalized from @malmans2's test in PR #8253 1512s original = create_test_data().astype(dtype).chunk(1) 1512s > with self.roundtrip( 1512s original, 1512s open_kwargs={ 1512s "chunks": {}, 1512s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1512s }, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________ TestZarrDictStore.test_zarr_fill_value_setting[3-float] ____________ 1512s 1512s self = 1512s dtype = 1512s 1512s @requires_dask 1512s @pytest.mark.parametrize("dtype", [int, float]) 1512s def test_zarr_fill_value_setting(self, dtype): 1512s # When zarr_format=2, _FillValue sets fill_value 1512s # When zarr_format=3, fill_value is set independently 1512s # We test this by writing a dask array with compute=False, 1512s # on read we should receive chunks filled with `fill_value` 1512s fv = -1 1512s ds = xr.Dataset( 1512s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1512s ) 1512s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1512s 1512s zarr_format_2 = ( 1512s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1512s ) or not has_zarr_v3 1512s if zarr_format_2: 1512s attr = "_FillValue" 1512s expected.foo.attrs[attr] = fv 1512s else: 1512s attr = "fill_value" 1512s if dtype is float: 1512s # for floats, Xarray inserts a default `np.nan` 1512s expected.foo.attrs["_FillValue"] = np.nan 1512s 1512s # turn off all decoding so we see what Zarr returns to us. 1512s # Since chunks, are not written, we should receive on `fill_value` 1512s open_kwargs = { 1512s "mask_and_scale": False, 1512s "consolidated": False, 1512s "use_zarr_fill_value_as_mask": False, 1512s } 1512s save_kwargs = dict(compute=False, consolidated=False) 1512s > with self.roundtrip( 1512s ds, 1512s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1512s open_kwargs=open_kwargs, 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'foo' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________ TestZarrDirectoryStore.test_zero_dimensional_variable[3] ___________ 1512s 1512s self = 1512s 1512s def test_zero_dimensional_variable(self) -> None: 1512s expected = create_test_data() 1512s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1512s expected["bytes_var"] = ([], b"foobar") 1512s expected["string_var"] = ([], "foobar") 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________________ TestZarrDirectoryStore.test_write_store[3] __________________ 1512s 1512s self = 1512s 1512s def test_write_store(self) -> None: 1512s expected = create_test_data() 1512s with self.create_store() as store: 1512s expected.dump_to_store(store) 1512s # we need to cf decode the store because it has time and 1512s # non-dimension coordinates 1512s > with xr.decode_cf(store) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1512s vars, attrs = obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'var3' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDirectoryStore.test_roundtrip_test_data[3] ______________ 1512s 1512s self = 1512s 1512s def test_roundtrip_test_data(self) -> None: 1512s expected = create_test_data() 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _____________________ TestZarrDirectoryStore.test_load[3] ______________________ 1512s 1512s self = 1512s 1512s def test_load(self) -> None: 1512s expected = create_test_data() 1512s 1512s @contextlib.contextmanager 1512s def assert_loads(vars=None): 1512s if vars is None: 1512s vars = expected 1512s with self.roundtrip(expected) as actual: 1512s for k, v in actual.variables.items(): 1512s # IndexVariables are eagerly loaded into memory 1512s assert v._in_memory == (k in actual.dims) 1512s yield actual 1512s for k, v in actual.variables.items(): 1512s if k in vars: 1512s assert v._in_memory 1512s assert_identical(expected, actual) 1512s 1512s with pytest.raises(AssertionError): 1512s # make sure the contextmanager works! 1512s > with assert_loads() as ds: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1512s with self.roundtrip(expected) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDirectoryStore.test_dataset_compute[3] ________________ 1512s 1512s self = 1512s 1512s def test_dataset_compute(self) -> None: 1512s expected = create_test_data() 1512s 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDirectoryStore.test_roundtrip_object_dtype[3] _____________ 1512s 1512s self = 1512s 1512s def test_roundtrip_object_dtype(self) -> None: 1512s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1512s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1512s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1512s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1512s strings = np.array(["ab", "cdef", "g"], dtype=object) 1512s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1512s all_nans = np.array([np.nan, np.nan], dtype=object) 1512s original = Dataset( 1512s { 1512s "floats": ("a", floats), 1512s "floats_nans": ("a", floats_nans), 1512s "bytes": ("b", bytes_), 1512s "bytes_nans": ("b", bytes_nans), 1512s "strings": ("b", strings), 1512s "strings_nans": ("b", strings_nans), 1512s "all_nans": ("c", all_nans), 1512s "nan": ([], np.nan), 1512s } 1512s ) 1512s expected = original.copy(deep=True) 1512s > with self.roundtrip(original) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'nan' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDirectoryStore.test_roundtrip_float64_data[3] _____________ 1512s 1512s self = 1512s 1512s def test_roundtrip_float64_data(self) -> None: 1512s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1512s > with self.roundtrip(expected) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDirectoryStore.test_orthogonal_indexing[3] ______________ 1512s 1512s self = 1512s 1512s def test_orthogonal_indexing(self) -> None: 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDirectoryStore.test_vectorized_indexing[3] ______________ 1512s 1512s self = 1512s 1512s def test_vectorized_indexing(self) -> None: 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _______ TestZarrDirectoryStore.test_vectorized_indexing_negative_step[3] _______ 1512s 1512s self = 1512s 1512s def test_vectorized_indexing_negative_step(self) -> None: 1512s # use dask explicitly when present 1512s open_kwargs: dict[str, Any] | None 1512s if has_dask: 1512s open_kwargs = {"chunks": {}} 1512s else: 1512s open_kwargs = None 1512s in_memory = create_test_data() 1512s 1512s def multiple_indexing(indexers): 1512s # make sure a sequence of lazy indexings certainly works. 1512s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1512s actual = on_disk["var3"] 1512s expected = in_memory["var3"] 1512s for ind in indexers: 1512s actual = actual.isel(ind) 1512s expected = expected.isel(ind) 1512s # make sure the array is not yet loaded into memory 1512s assert not actual.variable._in_memory 1512s assert_identical(expected, actual.load()) 1512s 1512s # with negative step slice. 1512s indexers = [ 1512s { 1512s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1512s "dim3": slice(-1, 1, -1), 1512s } 1512s ] 1512s > multiple_indexing(indexers) 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1512s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________ TestZarrDirectoryStore.test_outer_indexing_reversed[3] ____________ 1512s 1512s self = 1512s 1512s def test_outer_indexing_reversed(self) -> None: 1512s # regression test for GH6560 1512s ds = xr.Dataset( 1512s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1512s ) 1512s 1512s > with self.roundtrip(ds) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'z' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________________ TestZarrDirectoryStore.test_isel_dataarray[3] _________________ 1512s 1512s self = 1512s 1512s def test_isel_dataarray(self) -> None: 1512s # Make sure isel works lazily. GH:issue:1688 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ___________ TestZarrDirectoryStore.test_array_type_after_indexing[3] ___________ 1512s 1512s self = 1512s 1512s def test_array_type_after_indexing(self) -> None: 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ____________________ TestZarrDirectoryStore.test_dropna[3] _____________________ 1512s 1512s self = 1512s 1512s def test_dropna(self) -> None: 1512s # regression test for GH:issue:1694 1512s a = np.random.randn(4, 3) 1512s a[1, 1] = np.nan 1512s in_memory = xr.Dataset( 1512s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1512s ) 1512s 1512s assert_identical( 1512s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1512s ) 1512s 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'a' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______________ TestZarrDirectoryStore.test_ondisk_after_print[3] _______________ 1512s 1512s self = 1512s 1512s def test_ondisk_after_print(self) -> None: 1512s """Make sure print does not load file into memory""" 1512s in_memory = create_test_data() 1512s > with self.roundtrip(in_memory) as on_disk: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'dim2' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ________ TestZarrDirectoryStore.test_roundtrip_bytes_with_fill_value[3] ________ 1512s 1512s self = 1512s 1512s def test_roundtrip_bytes_with_fill_value(self) -> None: 1512s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1512s encoding = {"_FillValue": b"X", "dtype": "S1"} 1512s original = Dataset({"x": ("t", values, {}, encoding)}) 1512s expected = original.copy(deep=True) 1512s > with self.roundtrip(original) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _____ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value0-False] ______ 1512s 1512s self = 1512s fill_value = np.int8(-1), exp_fill_warning = False 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s ______ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value1-True] ______ 1512s 1512s self = 1512s fill_value = np.uint8(255), exp_fill_warning = True 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3--1-False] __________ 1512s 1512s self = 1512s fill_value = -1, exp_fill_warning = False 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3-255-True] __________ 1512s 1512s self = 1512s fill_value = 255, exp_fill_warning = True 1512s 1512s @pytest.mark.parametrize( 1512s ("fill_value", "exp_fill_warning"), 1512s [ 1512s (np.int8(-1), False), 1512s (np.uint8(255), True), 1512s (-1, False), 1512s (255, True), 1512s ], 1512s ) 1512s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1512s @contextlib.contextmanager 1512s def _roundtrip_with_warnings(*args, **kwargs): 1512s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1512s if exp_fill_warning and is_np2: 1512s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1512s SerializationWarning, 1512s match="_FillValue attribute can't be represented", 1512s ) 1512s else: 1512s warn_checker = contextlib.nullcontext() 1512s with warn_checker: 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s yield actual 1512s 1512s # regression/numpy2 test for 1512s encoding = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s "dtype": "i1", 1512s } 1512s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1512s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1512s 1512s attributes = { 1512s "_FillValue": fill_value, 1512s "_Unsigned": "true", 1512s } 1512s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1512s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1512s encoded = Dataset({"x": ("t", sb, attributes)}) 1512s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1512s 1512s > with _roundtrip_with_warnings(decoded) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1512s with self.roundtrip(*args, **kwargs) as actual: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'x' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Int8' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1512s 1512s self = 1512s 1512s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1512s original = self._create_cf_dataset() 1512s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = 1512s name = 'det_lim' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDirectoryStore.test_coordinate_variables_after_dataset_roundtrip[3] __ 1512s 1512s self = 1512s 1512s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1512s original = self._create_cf_dataset() 1512s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = 1512s name = 'det_lim' 1512s 1512s def open_store_variable(self, name): 1512s zarr_array = self.members[name] 1512s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1512s try_nczarr = self._mode == "r" 1512s dimensions, attributes = _get_zarr_dims_and_attrs( 1512s zarr_array, DIMENSION_KEY, try_nczarr 1512s ) 1512s attributes = dict(attributes) 1512s 1512s encoding = { 1512s "chunks": zarr_array.chunks, 1512s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1512s } 1512s 1512s if _zarr_v3(): 1512s encoding.update( 1512s { 1512s "compressors": zarr_array.compressors, 1512s "filters": zarr_array.filters, 1512s "shards": zarr_array.shards, 1512s } 1512s ) 1512s if self.zarr_group.metadata.zarr_format == 3: 1512s encoding.update({"serializer": zarr_array.serializer}) 1512s else: 1512s encoding.update( 1512s { 1512s "compressor": zarr_array.compressor, 1512s "filters": zarr_array.filters, 1512s } 1512s ) 1512s 1512s if self._use_zarr_fill_value_as_mask: 1512s # Setting this attribute triggers CF decoding for missing values 1512s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1512s if zarr_array.fill_value is not None: 1512s attributes["_FillValue"] = zarr_array.fill_value 1512s elif "_FillValue" in attributes: 1512s original_zarr_dtype = zarr_array.metadata.data_type 1512s attributes["_FillValue"] = FillValueCoder.decode( 1512s > attributes["_FillValue"], original_zarr_dtype.value 1512s ) 1512s E AttributeError: 'Float64' object has no attribute 'value' 1512s 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1512s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1512s 1512s self = 1512s 1512s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1512s self, 1512s ) -> None: 1512s original = self._create_cf_dataset() 1512s # The DataArray roundtrip should have the same warnings as the 1512s # Dataset, but we already tested for those, so just go for the 1512s # new warnings. It would appear that there is no way to tell 1512s # pytest "This warning and also this warning should both be 1512s # present". 1512s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1512s # needs the to_dataset. The other backends should be fine 1512s # without it. 1512s with pytest.warns( 1512s UserWarning, 1512s match=( 1512s r"Variable\(s\) referenced in bounds not in variables: " 1512s r"\['l(at|ong)itude_bnds'\]" 1512s ), 1512s ): 1512s > with self.roundtrip( 1512s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1512s ) as actual: 1512s 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1512s with self.open(store_target, **open_kwargs) as ds: 1512s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1512s return next(self.gen) 1512s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1512s with xr.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1512s backend_ds = backend.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1512s ds = store_entrypoint.open_dataset( 1512s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1512s vars, attrs = filename_or_obj.load() 1512s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1512s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1512s return Frozen(dict(*args, **kwargs)) 1512s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1512s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1512s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1512s 1512s self = , name = 'ln_p' 1512s 1512s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s 1513s During handling of the above exception, another exception occurred: 1513s 1513s self = 1513s 1513s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1513s self, 1513s ) -> None: 1513s original = self._create_cf_dataset() 1513s # The DataArray roundtrip should have the same warnings as the 1513s # Dataset, but we already tested for those, so just go for the 1513s # new warnings. It would appear that there is no way to tell 1513s # pytest "This warning and also this warning should both be 1513s # present". 1513s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1513s # needs the to_dataset. The other backends should be fine 1513s # without it. 1513s > with pytest.warns( 1513s UserWarning, 1513s match=( 1513s r"Variable\(s\) referenced in bounds not in variables: " 1513s r"\['l(at|ong)itude_bnds'\]" 1513s ), 1513s ): 1513s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1513s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1513s 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.')]. 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1513s ________________ TestZarrDirectoryStore.test_encoding_kwarg[3] _________________ 1513s 1513s self = 1513s 1513s def test_encoding_kwarg(self) -> None: 1513s ds = Dataset({"x": ("y", np.arange(10.0))}) 1513s 1513s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float32' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_default_fill_value[3] _______________ 1513s 1513s self = 1513s 1513s def test_default_fill_value(self) -> None: 1513s # Test default encoding for float: 1513s ds = Dataset({"x": ("y", np.arange(10.0))}) 1513s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float32' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord[3] ______ 1513s 1513s self = 1513s 1513s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1513s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1513s ds.y.encoding["_FillValue"] = None 1513s > with self.roundtrip(ds) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1513s 1513s self = 1513s 1513s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1513s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1513s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_encoding_same_dtype[3] ______________ 1513s 1513s self = 1513s 1513s def test_encoding_same_dtype(self) -> None: 1513s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1513s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float32' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrDirectoryStore.test_append_overwrite_values[3] ____________ 1513s 1513s self = 1513s 1513s def test_append_overwrite_values(self) -> None: 1513s # regression for GH1215 1513s data = create_test_data() 1513s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1513s self.save(data, tmp_file, mode="w") 1513s data["var2"][:] = -999 1513s data["var9"] = data["var2"] * 3 1513s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1513s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-False] __________ 1513s 1513s self = 1513s consolidated = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s def test_roundtrip_consolidated(self, consolidated) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip( 1513s expected, 1513s save_kwargs={"consolidated": consolidated}, 1513s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-True] __________ 1513s 1513s self = 1513s consolidated = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s def test_roundtrip_consolidated(self, consolidated) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip( 1513s expected, 1513s save_kwargs={"consolidated": consolidated}, 1513s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-None] __________ 1513s 1513s self = 1513s consolidated = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s def test_roundtrip_consolidated(self, consolidated) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip( 1513s expected, 1513s save_kwargs={"consolidated": consolidated}, 1513s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________ TestZarrDirectoryStore.test_read_non_consolidated_warning[3] _________ 1513s 1513s self = 1513s 1513s def test_read_non_consolidated_warning(self) -> None: 1513s expected = create_test_data() 1513s with self.create_zarr_target() as store: 1513s self.save( 1513s expected, store_target=store, consolidated=False, **self.version_kwargs 1513s ) 1513s with pytest.warns( 1513s RuntimeWarning, 1513s match="Failed to open Zarr store with consolidated", 1513s ): 1513s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'var3' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_non_existent_store[3] _______________ 1513s 1513s self = 1513s 1513s def test_non_existent_store(self) -> None: 1513s with pytest.raises( 1513s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1513s ): 1513s > xr.open_zarr(f"{uuid.uuid4()}") 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1513s store = ZarrStore.open_group( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1513s ) = _get_open_params( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1513s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1513s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1513s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1513s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1513s raise return_result 1513s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1513s return await coro 1513s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1513s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1513s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1513s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1513s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1513s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1513s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1513s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1513s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1513s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1513s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1513s await store._open() 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ee18e6b9-1a3c-4517-97d8-136eac1330ee') 1513s 1513s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1513s if not self.read_only: 1513s self.root.mkdir(parents=True, exist_ok=True) 1513s 1513s if not self.root.exists(): 1513s > raise FileNotFoundError(f"{self.root} does not exist") 1513s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ee18e6b9-1a3c-4517-97d8-136eac1330ee does not exist 1513s 1513s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1513s 1513s During handling of the above exception, another exception occurred: 1513s 1513s self = 1513s 1513s def test_non_existent_store(self) -> None: 1513s > with pytest.raises( 1513s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1513s ): 1513s E AssertionError: Regex pattern did not match. 1513s E Regex: '(No such file or directory|Unable to find group)' 1513s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/ee18e6b9-1a3c-4517-97d8-136eac1330ee does not exist' 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1513s __________________ TestZarrDirectoryStore.test_auto_chunk[3] ___________________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_auto_chunk(self) -> None: 1513s original = create_test_data().chunk() 1513s 1513s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________________ TestZarrDirectoryStore.test_manual_chunk[3] __________________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1513s def test_manual_chunk(self) -> None: 1513s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1513s 1513s # Using chunks = None should return non-chunked arrays 1513s open_kwargs: dict[str, Any] = {"chunks": None} 1513s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________ TestZarrDirectoryStore.test_warning_on_bad_chunks[3] _____________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_warning_on_bad_chunks(self) -> None: 1513s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1513s 1513s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1513s for chunks in bad_chunks: 1513s kwargs = {"chunks": chunks} 1513s with pytest.warns(UserWarning): 1513s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___________ TestZarrDirectoryStore.test_write_uneven_dask_chunks[3] ____________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_write_uneven_dask_chunks(self) -> None: 1513s # regression for GH#2225 1513s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1513s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrDirectoryStore.test_chunk_encoding[3] _________________ 1513s 1513s self = 1513s 1513s def test_chunk_encoding(self) -> None: 1513s # These datasets have no dask chunks. All chunking specified in 1513s # encoding 1513s data = create_test_data() 1513s chunks = (5, 5) 1513s data["var2"].encoding.update({"chunks": chunks}) 1513s 1513s > with self.roundtrip(data) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrDirectoryStore.test_shard_encoding[3] _________________ 1513s 1513s self = 1513s 1513s def test_shard_encoding(self) -> None: 1513s # These datasets have no dask chunks. All chunking/sharding specified in 1513s # encoding 1513s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1513s data = create_test_data() 1513s chunks = (1, 1) 1513s shards = (5, 5) 1513s data["var2"].encoding.update({"chunks": chunks}) 1513s data["var2"].encoding.update({"shards": shards}) 1513s > with self.roundtrip(data) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________ TestZarrDirectoryStore.test_write_persistence_modes[3-None] __________ 1513s 1513s self = 1513s group = None 1513s 1513s @pytest.mark.parametrize("group", [None, "group1"]) 1513s def test_write_persistence_modes(self, group) -> None: 1513s original = create_test_data() 1513s 1513s # overwrite mode 1513s > with self.roundtrip( 1513s original, 1513s save_kwargs={"mode": "w", "group": group}, 1513s open_kwargs={"group": group}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________ TestZarrDirectoryStore.test_write_persistence_modes[3-group1] _________ 1513s 1513s self = 1513s group = 'group1' 1513s 1513s @pytest.mark.parametrize("group", [None, "group1"]) 1513s def test_write_persistence_modes(self, group) -> None: 1513s original = create_test_data() 1513s 1513s # overwrite mode 1513s > with self.roundtrip( 1513s original, 1513s save_kwargs={"mode": "w", "group": group}, 1513s open_kwargs={"group": group}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_compressor_encoding[3] ______________ 1513s 1513s self = 1513s 1513s def test_compressor_encoding(self) -> None: 1513s # specify a custom compressor 1513s original = create_test_data() 1513s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1513s encoding_key = "compressors" 1513s # all parameters need to be explicitly specified in order for the comparison to pass below 1513s encoding = { 1513s "serializer": zarr.codecs.BytesCodec(endian="little"), 1513s encoding_key: ( 1513s zarr.codecs.BloscCodec( 1513s cname="zstd", 1513s clevel=3, 1513s shuffle="shuffle", 1513s typesize=8, 1513s blocksize=0, 1513s ), 1513s ), 1513s } 1513s else: 1513s from numcodecs.blosc import Blosc 1513s 1513s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1513s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1513s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1513s 1513s save_kwargs = dict(encoding={"var1": encoding}) 1513s 1513s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________________ TestZarrDirectoryStore.test_group[3] _____________________ 1513s 1513s self = 1513s 1513s def test_group(self) -> None: 1513s original = create_test_data() 1513s group = "some/random/path" 1513s > with self.roundtrip( 1513s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________________ TestZarrDirectoryStore.test_append_write[3] __________________ 1513s 1513s self = 1513s 1513s def test_append_write(self) -> None: 1513s > super().test_append_write() 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1513s with self.roundtrip_append(data) as actual: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1513s self.save(data[[key]], path, mode=mode, **save_kwargs) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1513s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____ TestZarrDirectoryStore.test_append_with_append_dim_not_set_raises[3] _____ 1513s 1513s self = 1513s 1513s def test_append_with_append_dim_not_set_raises(self) -> None: 1513s ds, ds_to_append, _ = create_append_test_data() 1513s with self.create_zarr_target() as store_target: 1513s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1513s with pytest.raises(ValueError, match="different dimension sizes"): 1513s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'da' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-U] _____ 1513s 1513s self = 1513s dtype = 'U' 1513s 1513s @pytest.mark.parametrize("dtype", ["U", "S"]) 1513s def test_append_string_length_mismatch_works(self, dtype) -> None: 1513s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1513s # ...but it probably would if we used object dtype 1513s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1513s expected = xr.concat([ds, ds_to_append], dim="time") 1513s with self.create_zarr_target() as store_target: 1513s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1513s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1513s _validate_datatypes_for_zarr_append( 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s vname = 'temperature' 1513s existing_var = Size: 96B 1513s [3 values with dtype=>U8] 1513s new_var = Size: 60B 1513s array(['abc', 'def', 'ghijk'], dtype='>U5') 1513s 1513s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1513s """If variable exists in the store, confirm dtype of the data to append is compatible with 1513s existing dtype. 1513s """ 1513s if ( 1513s np.issubdtype(new_var.dtype, np.number) 1513s or np.issubdtype(new_var.dtype, np.datetime64) 1513s or np.issubdtype(new_var.dtype, np.bool_) 1513s or new_var.dtype == object 1513s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1513s ): 1513s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1513s # new to the dataset, because in this case there is no existing var to compare it to; 1513s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1513s # we can be confident appending won't cause problems. Examples of dtypes which are not 1513s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1513s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1513s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1513s f"dataset to append has dtype {new_var.dtype}." 1513s ) 1513s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype >U8 but dataset to append has dtype >U5. 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1513s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-S] _____ 1513s 1513s self = 1513s dtype = 'S' 1513s 1513s @pytest.mark.parametrize("dtype", ["U", "S"]) 1513s def test_append_string_length_mismatch_works(self, dtype) -> None: 1513s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1513s # ...but it probably would if we used object dtype 1513s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1513s expected = xr.concat([ds, ds_to_append], dim="time") 1513s with self.create_zarr_target() as store_target: 1513s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1513s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1513s _validate_datatypes_for_zarr_append( 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s vname = 'temperature' 1513s existing_var = Size: 6B 1513s [3 values with dtype=|S2] 1513s new_var = Size: 9B 1513s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1513s 1513s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1513s """If variable exists in the store, confirm dtype of the data to append is compatible with 1513s existing dtype. 1513s """ 1513s if ( 1513s np.issubdtype(new_var.dtype, np.number) 1513s or np.issubdtype(new_var.dtype, np.datetime64) 1513s or np.issubdtype(new_var.dtype, np.bool_) 1513s or new_var.dtype == object 1513s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1513s ): 1513s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1513s # new to the dataset, because in this case there is no existing var to compare it to; 1513s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1513s # we can be confident appending won't cause problems. Examples of dtypes which are not 1513s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1513s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1513s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1513s f"dataset to append has dtype {new_var.dtype}." 1513s ) 1513s 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. 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1513s ___ TestZarrDirectoryStore.test_check_encoding_is_consistent_after_append[3] ___ 1513s 1513s self = 1513s 1513s def test_check_encoding_is_consistent_after_append(self) -> None: 1513s ds, ds_to_append, _ = create_append_test_data() 1513s 1513s # check encoding consistency 1513s with self.create_zarr_target() as store_target: 1513s import numcodecs 1513s 1513s encoding_value: Any 1513s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1513s compressor = zarr.codecs.BloscCodec() 1513s else: 1513s compressor = numcodecs.Blosc() 1513s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1513s encoding_value = (compressor,) if has_zarr_v3 else compressor 1513s 1513s encoding = {"da": {encoding_key: encoding_value}} 1513s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1513s > original_ds = xr.open_dataset( 1513s store_target, engine="zarr", **self.version_kwargs 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'da' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___________ TestZarrDirectoryStore.test_append_with_new_variable[3] ____________ 1513s 1513s self = 1513s 1513s def test_append_with_new_variable(self) -> None: 1513s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1513s 1513s # check append mode for new variable 1513s with self.create_zarr_target() as store_target: 1513s combined = xr.concat([ds, ds_to_append], dim="time") 1513s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1513s assert_identical( 1513s combined, 1513s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'da' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_append_with_append_dim_no_overwrite[3] ______ 1513s 1513s self = 1513s 1513s def test_append_with_append_dim_no_overwrite(self) -> None: 1513s ds, ds_to_append, _ = create_append_test_data() 1513s with self.create_zarr_target() as store_target: 1513s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1513s original = xr.concat([ds, ds_to_append], dim="time") 1513s original2 = xr.concat([original, ds_to_append], dim="time") 1513s 1513s # overwrite a coordinate; 1513s # for mode='a-', this will not get written to the store 1513s # because it does not have the append_dim as a dim 1513s lon = ds_to_append.lon.to_numpy().copy() 1513s lon[:] = -999 1513s ds_to_append["lon"] = lon 1513s > ds_to_append.to_zarr( 1513s store_target, mode="a-", append_dim="time", **self.version_kwargs 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'da' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________ TestZarrDirectoryStore.test_to_zarr_compute_false_roundtrip[3] ________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_to_zarr_compute_false_roundtrip(self) -> None: 1513s from dask.delayed import Delayed 1513s 1513s original = create_test_data().chunk() 1513s 1513s with self.create_zarr_target() as store: 1513s delayed_obj = self.save(original, store, compute=False) 1513s assert isinstance(delayed_obj, Delayed) 1513s 1513s # make sure target store has not been written to yet 1513s with pytest.raises(AssertionError): 1513s > with self.open(store) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____ TestZarrDirectoryStore.test_to_zarr_append_compute_false_roundtrip[3] _____ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1513s from dask.delayed import Delayed 1513s 1513s ds, ds_to_append, _ = create_append_test_data() 1513s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1513s 1513s with pytest.warns(SerializationWarning): 1513s with self.create_zarr_target() as store: 1513s delayed_obj = self.save(ds, store, compute=False, mode="w") 1513s assert isinstance(delayed_obj, Delayed) 1513s 1513s with pytest.raises(AssertionError): 1513s > with self.open(store) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'da' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_save_emptydim[3-False] ______________ 1513s 1513s self = 1513s chunk = False 1513s 1513s @pytest.mark.parametrize("chunk", [False, True]) 1513s def test_save_emptydim(self, chunk) -> None: 1513s if chunk and not has_dask: 1513s pytest.skip("requires dask") 1513s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1513s if chunk: 1513s ds = ds.chunk({}) # chunk dataset to save dask array 1513s > with self.roundtrip(ds) as ds_reload: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_save_emptydim[3-True] _______________ 1513s 1513s self = 1513s chunk = True 1513s 1513s @pytest.mark.parametrize("chunk", [False, True]) 1513s def test_save_emptydim(self, chunk) -> None: 1513s if chunk and not has_dask: 1513s pytest.skip("requires dask") 1513s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1513s if chunk: 1513s ds = ds.chunk({}) # chunk dataset to save dask array 1513s > with self.roundtrip(ds) as ds_reload: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___ TestZarrDirectoryStore.test_no_warning_from_open_emptydim_with_chunks[3] ___ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1513s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1513s with assert_no_warnings(): 1513s with warnings.catch_warnings(): 1513s warnings.filterwarnings( 1513s "ignore", 1513s message=".*Zarr format 3 specification.*", 1513s category=UserWarning, 1513s ) 1513s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____ TestZarrDirectoryStore.test_write_region[3-False-False-False-False] ______ 1513s 1513s self = 1513s consolidated = False, compute = False, use_dask = False, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-True] ______ 1513s 1513s self = 1513s consolidated = True, compute = False, use_dask = False, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-None] ______ 1513s 1513s self = 1513s consolidated = None, compute = False, use_dask = False, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-False] ______ 1513s 1513s self = 1513s consolidated = False, compute = True, use_dask = False, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = True, use_dask = False, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = True, use_dask = False, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-False] ______ 1513s 1513s self = 1513s consolidated = False, compute = False, use_dask = True, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = False, use_dask = True, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = False, use_dask = True, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-False-True-True-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = True, use_dask = True, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = True, use_dask = True, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = True, use_dask = True, write_empty = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-False] ______ 1513s 1513s self = 1513s consolidated = False, compute = False, use_dask = False, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = False, use_dask = False, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = False, use_dask = False, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-True-False-True-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = True, use_dask = False, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = True, use_dask = False, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = True, use_dask = False, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-True-True-False-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = False, use_dask = True, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = False, use_dask = True, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = False, use_dask = True, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = True, use_dask = True, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-True] ________ 1513s 1513s self = 1513s consolidated = True, compute = True, use_dask = True, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-None] ________ 1513s 1513s self = 1513s consolidated = None, compute = True, use_dask = True, write_empty = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-False] ______ 1513s 1513s self = 1513s consolidated = False, compute = False, use_dask = False, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = False, use_dask = False, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = False, use_dask = False, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-None-False-True-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = True, use_dask = False, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = True, use_dask = False, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = True, use_dask = False, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_region[3-None-True-False-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = False, use_dask = True, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-True] _______ 1513s 1513s self = 1513s consolidated = True, compute = False, use_dask = True, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-None] _______ 1513s 1513s self = 1513s consolidated = None, compute = False, use_dask = True, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s assert_identical(actual, zeros) 1513s for i in range(0, 10, 2): 1513s region = {"x": slice(i, i + 2)} 1513s > nonzeros.isel(region).to_zarr( 1513s store, 1513s region=region, 1513s consolidated=consolidated, 1513s write_empty_chunks=write_empty, 1513s **self.version_kwargs, 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-False] _______ 1513s 1513s self = 1513s consolidated = False, compute = True, use_dask = True, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-True] ________ 1513s 1513s self = 1513s consolidated = True, compute = True, use_dask = True, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-None] ________ 1513s 1513s self = 1513s consolidated = None, compute = True, use_dask = True, write_empty = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s @pytest.mark.parametrize("compute", [False, True]) 1513s @pytest.mark.parametrize("use_dask", [False, True]) 1513s @pytest.mark.parametrize("write_empty", [False, True, None]) 1513s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1513s if (use_dask or not compute) and not has_dask: 1513s pytest.skip("requires dask") 1513s 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s 1513s if use_dask: 1513s zeros = zeros.chunk(2) 1513s nonzeros = nonzeros.chunk(2) 1513s 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr( 1513s store, 1513s consolidated=consolidated, 1513s compute=compute, 1513s encoding={"u": dict(chunks=2)}, 1513s **self.version_kwargs, 1513s ) 1513s if compute: 1513s > with xr.open_zarr( 1513s store, consolidated=consolidated, **self.version_kwargs 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrDirectoryStore.test_write_region_mode[3-None] _____________ 1513s 1513s self = 1513s mode = None 1513s 1513s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1513s def test_write_region_mode(self, mode) -> None: 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr(store, **self.version_kwargs) 1513s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1513s > nonzeros.isel(region).to_zarr( 1513s store, region=region, mode=mode, **self.version_kwargs 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________ TestZarrDirectoryStore.test_write_region_mode[3-r+] ______________ 1513s 1513s self = 1513s mode = 'r+' 1513s 1513s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1513s def test_write_region_mode(self, mode) -> None: 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr(store, **self.version_kwargs) 1513s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1513s > nonzeros.isel(region).to_zarr( 1513s store, region=region, mode=mode, **self.version_kwargs 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_write_region_mode[3-a] ______________ 1513s 1513s self = 1513s mode = 'a' 1513s 1513s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1513s def test_write_region_mode(self, mode) -> None: 1513s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1513s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1513s with self.create_zarr_target() as store: 1513s zeros.to_zarr(store, **self.version_kwargs) 1513s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1513s > nonzeros.isel(region).to_zarr( 1513s store, region=region, mode=mode, **self.version_kwargs 1513s ) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______ TestZarrDirectoryStore.test_write_preexisting_override_metadata[3] ______ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_write_preexisting_override_metadata(self) -> None: 1513s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1513s original = Dataset( 1513s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1513s attrs={"global": "original"}, 1513s ) 1513s both_modified = Dataset( 1513s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1513s attrs={"global": "modified"}, 1513s ) 1513s global_modified = Dataset( 1513s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1513s attrs={"global": "modified"}, 1513s ) 1513s only_new_data = Dataset( 1513s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1513s attrs={"global": "original"}, 1513s ) 1513s 1513s with self.create_zarr_target() as store: 1513s original.to_zarr(store, compute=False, **self.version_kwargs) 1513s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'u' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrDirectoryStore.test_encoding_chunksizes[3] ______________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_encoding_chunksizes(self) -> None: 1513s # regression test for GH2278 1513s # see also test_encoding_chunksizes_unlimited 1513s nx, ny, nt = 4, 4, 5 1513s original = xr.Dataset( 1513s {}, 1513s coords={ 1513s "x": np.arange(nx), 1513s "y": np.arange(ny), 1513s "t": np.arange(nt), 1513s }, 1513s ) 1513s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1513s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1513s 1513s > with self.roundtrip(original) as ds1: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'v' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____ TestZarrDirectoryStore.test_chunk_encoding_with_partial_dask_chunks[3] ____ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1513s original = xr.Dataset( 1513s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1513s ).chunk({"a": 3}) 1513s 1513s > with self.roundtrip( 1513s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1513s ) as ds1: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________ TestZarrDirectoryStore.test_open_zarr_use_cftime[3] ______________ 1513s 1513s self = 1513s 1513s @requires_cftime 1513s def test_open_zarr_use_cftime(self) -> None: 1513s ds = create_test_data() 1513s with self.create_zarr_target() as store_target: 1513s ds.to_zarr(store_target, **self.version_kwargs) 1513s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrDirectoryStore.test_write_read_select_write[3] ____________ 1513s 1513s self = 1513s 1513s def test_write_read_select_write(self) -> None: 1513s # Test for https://github.com/pydata/xarray/issues/4084 1513s ds = create_test_data() 1513s 1513s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1513s with self.create_zarr_target() as initial_store: 1513s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1513s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrDirectoryStore.test_attributes[3-obj1] ________________ 1513s 1513s self = 1513s obj = Size: 8B 1513s array(nan) 1513s Attributes: 1513s good: {'key': 'value'} 1513s 1513s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1513s def test_attributes(self, obj) -> None: 1513s obj = obj.copy() 1513s 1513s obj.attrs["good"] = {"key": "value"} 1513s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1513s with self.create_zarr_target() as store_target: 1513s ds.to_zarr(store_target, **self.version_kwargs) 1513s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'foo' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] _ 1513s 1513s self = 1513s dtype = 'datetime64[ns]' 1513s 1513s @requires_dask 1513s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1513s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1513s # Generalized from @malmans2's test in PR #8253 1513s original = create_test_data().astype(dtype).chunk(1) 1513s > with self.roundtrip( 1513s original, 1513s open_kwargs={ 1513s "chunks": {}, 1513s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1513s }, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1513s 1513s self = 1513s dtype = 'timedelta64[ns]' 1513s 1513s @requires_dask 1513s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1513s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1513s # Generalized from @malmans2's test in PR #8253 1513s original = create_test_data().astype(dtype).chunk(1) 1513s > with self.roundtrip( 1513s original, 1513s open_kwargs={ 1513s "chunks": {}, 1513s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1513s }, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________ TestZarrDirectoryStore.test_zarr_fill_value_setting[3-float] _________ 1513s 1513s self = 1513s dtype = 1513s 1513s @requires_dask 1513s @pytest.mark.parametrize("dtype", [int, float]) 1513s def test_zarr_fill_value_setting(self, dtype): 1513s # When zarr_format=2, _FillValue sets fill_value 1513s # When zarr_format=3, fill_value is set independently 1513s # We test this by writing a dask array with compute=False, 1513s # on read we should receive chunks filled with `fill_value` 1513s fv = -1 1513s ds = xr.Dataset( 1513s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1513s ) 1513s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1513s 1513s zarr_format_2 = ( 1513s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1513s ) or not has_zarr_v3 1513s if zarr_format_2: 1513s attr = "_FillValue" 1513s expected.foo.attrs[attr] = fv 1513s else: 1513s attr = "fill_value" 1513s if dtype is float: 1513s # for floats, Xarray inserts a default `np.nan` 1513s expected.foo.attrs["_FillValue"] = np.nan 1513s 1513s # turn off all decoding so we see what Zarr returns to us. 1513s # Since chunks, are not written, we should receive on `fill_value` 1513s open_kwargs = { 1513s "mask_and_scale": False, 1513s "consolidated": False, 1513s "use_zarr_fill_value_as_mask": False, 1513s } 1513s save_kwargs = dict(compute=False, consolidated=False) 1513s > with self.roundtrip( 1513s ds, 1513s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1513s open_kwargs=open_kwargs, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'foo' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________ TestZarrWriteEmpty.test_zero_dimensional_variable[3] _____________ 1513s 1513s self = 1513s 1513s def test_zero_dimensional_variable(self) -> None: 1513s expected = create_test_data() 1513s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1513s expected["bytes_var"] = ([], b"foobar") 1513s expected["string_var"] = ([], "foobar") 1513s > with self.roundtrip(expected) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________________ TestZarrWriteEmpty.test_write_store[3] ____________________ 1513s 1513s self = 1513s 1513s def test_write_store(self) -> None: 1513s expected = create_test_data() 1513s with self.create_store() as store: 1513s expected.dump_to_store(store) 1513s # we need to cf decode the store because it has time and 1513s # non-dimension coordinates 1513s > with xr.decode_cf(store) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1513s vars, attrs = obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'var2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_roundtrip_test_data[3] ________________ 1513s 1513s self = 1513s 1513s def test_roundtrip_test_data(self) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip(expected) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______________________ TestZarrWriteEmpty.test_load[3] ________________________ 1513s 1513s self = 1513s 1513s def test_load(self) -> None: 1513s expected = create_test_data() 1513s 1513s @contextlib.contextmanager 1513s def assert_loads(vars=None): 1513s if vars is None: 1513s vars = expected 1513s with self.roundtrip(expected) as actual: 1513s for k, v in actual.variables.items(): 1513s # IndexVariables are eagerly loaded into memory 1513s assert v._in_memory == (k in actual.dims) 1513s yield actual 1513s for k, v in actual.variables.items(): 1513s if k in vars: 1513s assert v._in_memory 1513s assert_identical(expected, actual) 1513s 1513s with pytest.raises(AssertionError): 1513s # make sure the contextmanager works! 1513s > with assert_loads() as ds: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1513s with self.roundtrip(expected) as actual: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________________ TestZarrWriteEmpty.test_dataset_compute[3] __________________ 1513s 1513s self = 1513s 1513s def test_dataset_compute(self) -> None: 1513s expected = create_test_data() 1513s 1513s > with self.roundtrip(expected) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrWriteEmpty.test_roundtrip_object_dtype[3] _______________ 1513s 1513s self = 1513s 1513s def test_roundtrip_object_dtype(self) -> None: 1513s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1513s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1513s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1513s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1513s strings = np.array(["ab", "cdef", "g"], dtype=object) 1513s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1513s all_nans = np.array([np.nan, np.nan], dtype=object) 1513s original = Dataset( 1513s { 1513s "floats": ("a", floats), 1513s "floats_nans": ("a", floats_nans), 1513s "bytes": ("b", bytes_), 1513s "bytes_nans": ("b", bytes_nans), 1513s "strings": ("b", strings), 1513s "strings_nans": ("b", strings_nans), 1513s "all_nans": ("c", all_nans), 1513s "nan": ([], np.nan), 1513s } 1513s ) 1513s expected = original.copy(deep=True) 1513s > with self.roundtrip(original) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'nan' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrWriteEmpty.test_roundtrip_float64_data[3] _______________ 1513s 1513s self = 1513s 1513s def test_roundtrip_float64_data(self) -> None: 1513s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1513s > with self.roundtrip(expected) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_orthogonal_indexing[3] ________________ 1513s 1513s self = 1513s 1513s def test_orthogonal_indexing(self) -> None: 1513s in_memory = create_test_data() 1513s > with self.roundtrip(in_memory) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_vectorized_indexing[3] ________________ 1513s 1513s self = 1513s 1513s def test_vectorized_indexing(self) -> None: 1513s in_memory = create_test_data() 1513s > with self.roundtrip(in_memory) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _________ TestZarrWriteEmpty.test_vectorized_indexing_negative_step[3] _________ 1513s 1513s self = 1513s 1513s def test_vectorized_indexing_negative_step(self) -> None: 1513s # use dask explicitly when present 1513s open_kwargs: dict[str, Any] | None 1513s if has_dask: 1513s open_kwargs = {"chunks": {}} 1513s else: 1513s open_kwargs = None 1513s in_memory = create_test_data() 1513s 1513s def multiple_indexing(indexers): 1513s # make sure a sequence of lazy indexings certainly works. 1513s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1513s actual = on_disk["var3"] 1513s expected = in_memory["var3"] 1513s for ind in indexers: 1513s actual = actual.isel(ind) 1513s expected = expected.isel(ind) 1513s # make sure the array is not yet loaded into memory 1513s assert not actual.variable._in_memory 1513s assert_identical(expected, actual.load()) 1513s 1513s # with negative step slice. 1513s indexers = [ 1513s { 1513s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1513s "dim3": slice(-1, 1, -1), 1513s } 1513s ] 1513s > multiple_indexing(indexers) 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1513s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrWriteEmpty.test_outer_indexing_reversed[3] ______________ 1513s 1513s self = 1513s 1513s def test_outer_indexing_reversed(self) -> None: 1513s # regression test for GH6560 1513s ds = xr.Dataset( 1513s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1513s ) 1513s 1513s > with self.roundtrip(ds) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'z' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________________ TestZarrWriteEmpty.test_isel_dataarray[3] ___________________ 1513s 1513s self = 1513s 1513s def test_isel_dataarray(self) -> None: 1513s # Make sure isel works lazily. GH:issue:1688 1513s in_memory = create_test_data() 1513s > with self.roundtrip(in_memory) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________ TestZarrWriteEmpty.test_array_type_after_indexing[3] _____________ 1513s 1513s self = 1513s 1513s def test_array_type_after_indexing(self) -> None: 1513s in_memory = create_test_data() 1513s > with self.roundtrip(in_memory) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________________ TestZarrWriteEmpty.test_dropna[3] _______________________ 1513s 1513s self = 1513s 1513s def test_dropna(self) -> None: 1513s # regression test for GH:issue:1694 1513s a = np.random.randn(4, 3) 1513s a[1, 1] = np.nan 1513s in_memory = xr.Dataset( 1513s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1513s ) 1513s 1513s assert_identical( 1513s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1513s ) 1513s 1513s > with self.roundtrip(in_memory) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'a' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_ondisk_after_print[3] _________________ 1513s 1513s self = 1513s 1513s def test_ondisk_after_print(self) -> None: 1513s """Make sure print does not load file into memory""" 1513s in_memory = create_test_data() 1513s > with self.roundtrip(in_memory) as on_disk: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________ TestZarrWriteEmpty.test_roundtrip_bytes_with_fill_value[3] __________ 1513s 1513s self = 1513s 1513s def test_roundtrip_bytes_with_fill_value(self) -> None: 1513s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1513s encoding = {"_FillValue": b"X", "dtype": "S1"} 1513s original = Dataset({"x": ("t", values, {}, encoding)}) 1513s expected = original.copy(deep=True) 1513s > with self.roundtrip(original) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value0-False] ________ 1513s 1513s self = 1513s fill_value = np.int8(-1), exp_fill_warning = False 1513s 1513s @pytest.mark.parametrize( 1513s ("fill_value", "exp_fill_warning"), 1513s [ 1513s (np.int8(-1), False), 1513s (np.uint8(255), True), 1513s (-1, False), 1513s (255, True), 1513s ], 1513s ) 1513s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1513s @contextlib.contextmanager 1513s def _roundtrip_with_warnings(*args, **kwargs): 1513s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1513s if exp_fill_warning and is_np2: 1513s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1513s SerializationWarning, 1513s match="_FillValue attribute can't be represented", 1513s ) 1513s else: 1513s warn_checker = contextlib.nullcontext() 1513s with warn_checker: 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s yield actual 1513s 1513s # regression/numpy2 test for 1513s encoding = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s "dtype": "i1", 1513s } 1513s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1513s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1513s 1513s attributes = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s } 1513s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1513s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1513s encoded = Dataset({"x": ("t", sb, attributes)}) 1513s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1513s 1513s > with _roundtrip_with_warnings(decoded) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Int8' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value1-True] ________ 1513s 1513s self = 1513s fill_value = np.uint8(255), exp_fill_warning = True 1513s 1513s @pytest.mark.parametrize( 1513s ("fill_value", "exp_fill_warning"), 1513s [ 1513s (np.int8(-1), False), 1513s (np.uint8(255), True), 1513s (-1, False), 1513s (255, True), 1513s ], 1513s ) 1513s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1513s @contextlib.contextmanager 1513s def _roundtrip_with_warnings(*args, **kwargs): 1513s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1513s if exp_fill_warning and is_np2: 1513s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1513s SerializationWarning, 1513s match="_FillValue attribute can't be represented", 1513s ) 1513s else: 1513s warn_checker = contextlib.nullcontext() 1513s with warn_checker: 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s yield actual 1513s 1513s # regression/numpy2 test for 1513s encoding = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s "dtype": "i1", 1513s } 1513s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1513s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1513s 1513s attributes = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s } 1513s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1513s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1513s encoded = Dataset({"x": ("t", sb, attributes)}) 1513s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1513s 1513s > with _roundtrip_with_warnings(decoded) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Int8' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3--1-False] ____________ 1513s 1513s self = 1513s fill_value = -1, exp_fill_warning = False 1513s 1513s @pytest.mark.parametrize( 1513s ("fill_value", "exp_fill_warning"), 1513s [ 1513s (np.int8(-1), False), 1513s (np.uint8(255), True), 1513s (-1, False), 1513s (255, True), 1513s ], 1513s ) 1513s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1513s @contextlib.contextmanager 1513s def _roundtrip_with_warnings(*args, **kwargs): 1513s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1513s if exp_fill_warning and is_np2: 1513s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1513s SerializationWarning, 1513s match="_FillValue attribute can't be represented", 1513s ) 1513s else: 1513s warn_checker = contextlib.nullcontext() 1513s with warn_checker: 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s yield actual 1513s 1513s # regression/numpy2 test for 1513s encoding = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s "dtype": "i1", 1513s } 1513s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1513s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1513s 1513s attributes = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s } 1513s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1513s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1513s encoded = Dataset({"x": ("t", sb, attributes)}) 1513s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1513s 1513s > with _roundtrip_with_warnings(decoded) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Int8' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-255-True] ____________ 1513s 1513s self = 1513s fill_value = 255, exp_fill_warning = True 1513s 1513s @pytest.mark.parametrize( 1513s ("fill_value", "exp_fill_warning"), 1513s [ 1513s (np.int8(-1), False), 1513s (np.uint8(255), True), 1513s (-1, False), 1513s (255, True), 1513s ], 1513s ) 1513s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1513s @contextlib.contextmanager 1513s def _roundtrip_with_warnings(*args, **kwargs): 1513s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1513s if exp_fill_warning and is_np2: 1513s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1513s SerializationWarning, 1513s match="_FillValue attribute can't be represented", 1513s ) 1513s else: 1513s warn_checker = contextlib.nullcontext() 1513s with warn_checker: 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s yield actual 1513s 1513s # regression/numpy2 test for 1513s encoding = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s "dtype": "i1", 1513s } 1513s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1513s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1513s 1513s attributes = { 1513s "_FillValue": fill_value, 1513s "_Unsigned": "true", 1513s } 1513s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1513s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1513s encoded = Dataset({"x": ("t", sb, attributes)}) 1513s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1513s 1513s > with _roundtrip_with_warnings(decoded) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1513s with self.roundtrip(*args, **kwargs) as actual: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Int8' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1513s 1513s self = 1513s 1513s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1513s original = self._create_cf_dataset() 1513s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = 1513s name = 'det_lim' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___ TestZarrWriteEmpty.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1513s 1513s self = 1513s 1513s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1513s original = self._create_cf_dataset() 1513s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = 1513s name = 'det_lim' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1513s 1513s self = 1513s 1513s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1513s self, 1513s ) -> None: 1513s original = self._create_cf_dataset() 1513s # The DataArray roundtrip should have the same warnings as the 1513s # Dataset, but we already tested for those, so just go for the 1513s # new warnings. It would appear that there is no way to tell 1513s # pytest "This warning and also this warning should both be 1513s # present". 1513s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1513s # needs the to_dataset. The other backends should be fine 1513s # without it. 1513s with pytest.warns( 1513s UserWarning, 1513s match=( 1513s r"Variable\(s\) referenced in bounds not in variables: " 1513s r"\['l(at|ong)itude_bnds'\]" 1513s ), 1513s ): 1513s > with self.roundtrip( 1513s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'ln_p' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s 1513s During handling of the above exception, another exception occurred: 1513s 1513s self = 1513s 1513s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1513s self, 1513s ) -> None: 1513s original = self._create_cf_dataset() 1513s # The DataArray roundtrip should have the same warnings as the 1513s # Dataset, but we already tested for those, so just go for the 1513s # new warnings. It would appear that there is no way to tell 1513s # pytest "This warning and also this warning should both be 1513s # present". 1513s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1513s # needs the to_dataset. The other backends should be fine 1513s # without it. 1513s > with pytest.warns( 1513s UserWarning, 1513s match=( 1513s r"Variable\(s\) referenced in bounds not in variables: " 1513s r"\['l(at|ong)itude_bnds'\]" 1513s ), 1513s ): 1513s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1513s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1513s 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.')]. 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1513s __________________ TestZarrWriteEmpty.test_encoding_kwarg[3] ___________________ 1513s 1513s self = 1513s 1513s def test_encoding_kwarg(self) -> None: 1513s ds = Dataset({"x": ("y", np.arange(10.0))}) 1513s 1513s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float32' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_default_fill_value[3] _________________ 1513s 1513s self = 1513s 1513s def test_default_fill_value(self) -> None: 1513s # Test default encoding for float: 1513s ds = Dataset({"x": ("y", np.arange(10.0))}) 1513s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float32' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord[3] ________ 1513s 1513s self = 1513s 1513s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1513s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1513s ds.y.encoding["_FillValue"] = None 1513s > with self.roundtrip(ds) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1513s 1513s self = 1513s 1513s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1513s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1513s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_encoding_same_dtype[3] ________________ 1513s 1513s self = 1513s 1513s def test_encoding_same_dtype(self) -> None: 1513s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1513s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1513s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'x' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float32' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ______________ TestZarrWriteEmpty.test_append_overwrite_values[3] ______________ 1513s 1513s self = 1513s 1513s def test_append_overwrite_values(self) -> None: 1513s # regression for GH1215 1513s data = create_test_data() 1513s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1513s self.save(data, tmp_file, mode="w") 1513s data["var2"][:] = -999 1513s data["var9"] = data["var2"] * 3 1513s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1513s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1513s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1513s return to_zarr( # type: ignore[call-overload,misc] 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1513s dump_to_store(dataset, zstore, writer, encoding=encoding) 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1513s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1513s k: self.open_store_variable(name=k) for k in existing_variable_names 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-False] ____________ 1513s 1513s self = 1513s consolidated = False 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s def test_roundtrip_consolidated(self, consolidated) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip( 1513s expected, 1513s save_kwargs={"consolidated": consolidated}, 1513s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'var2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-True] ____________ 1513s 1513s self = 1513s consolidated = True 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s def test_roundtrip_consolidated(self, consolidated) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip( 1513s expected, 1513s save_kwargs={"consolidated": consolidated}, 1513s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-None] ____________ 1513s 1513s self = 1513s consolidated = None 1513s 1513s @pytest.mark.parametrize("consolidated", [False, True, None]) 1513s def test_roundtrip_consolidated(self, consolidated) -> None: 1513s expected = create_test_data() 1513s > with self.roundtrip( 1513s expected, 1513s save_kwargs={"consolidated": consolidated}, 1513s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___________ TestZarrWriteEmpty.test_read_non_consolidated_warning[3] ___________ 1513s 1513s self = 1513s 1513s def test_read_non_consolidated_warning(self) -> None: 1513s expected = create_test_data() 1513s with self.create_zarr_target() as store: 1513s self.save( 1513s expected, store_target=store, consolidated=False, **self.version_kwargs 1513s ) 1513s with pytest.warns( 1513s RuntimeWarning, 1513s match="Failed to open Zarr store with consolidated", 1513s ): 1513s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'var2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ________________ TestZarrWriteEmpty.test_non_existent_store[3] _________________ 1513s 1513s self = 1513s 1513s def test_non_existent_store(self) -> None: 1513s with pytest.raises( 1513s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1513s ): 1513s > xr.open_zarr(f"{uuid.uuid4()}") 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1513s ds = open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1513s store = ZarrStore.open_group( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1513s ) = _get_open_params( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1513s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1513s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1513s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1513s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1513s raise return_result 1513s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1513s return await coro 1513s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1513s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1513s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1513s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1513s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1513s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1513s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1513s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1513s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1513s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1513s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1513s await store._open() 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = LocalStore('file:///tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/4722bc8d-7d3d-42e8-9701-4cf26d8c5357') 1513s 1513s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1513s if not self.read_only: 1513s self.root.mkdir(parents=True, exist_ok=True) 1513s 1513s if not self.root.exists(): 1513s > raise FileNotFoundError(f"{self.root} does not exist") 1513s E FileNotFoundError: /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/4722bc8d-7d3d-42e8-9701-4cf26d8c5357 does not exist 1513s 1513s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1513s 1513s During handling of the above exception, another exception occurred: 1513s 1513s self = 1513s 1513s def test_non_existent_store(self) -> None: 1513s > with pytest.raises( 1513s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1513s ): 1513s E AssertionError: Regex pattern did not match. 1513s E Regex: '(No such file or directory|Unable to find group)' 1513s E Input: '/tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build/4722bc8d-7d3d-42e8-9701-4cf26d8c5357 does not exist' 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1513s ____________________ TestZarrWriteEmpty.test_auto_chunk[3] _____________________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_auto_chunk(self) -> None: 1513s original = create_test_data().chunk() 1513s 1513s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___________________ TestZarrWriteEmpty.test_manual_chunk[3] ____________________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1513s def test_manual_chunk(self) -> None: 1513s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1513s 1513s # Using chunks = None should return non-chunked arrays 1513s open_kwargs: dict[str, Any] = {"chunks": None} 1513s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _______________ TestZarrWriteEmpty.test_warning_on_bad_chunks[3] _______________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_warning_on_bad_chunks(self) -> None: 1513s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1513s 1513s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1513s for chunks in bad_chunks: 1513s kwargs = {"chunks": chunks} 1513s with pytest.warns(UserWarning): 1513s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s _____________ TestZarrWriteEmpty.test_write_uneven_dask_chunks[3] ______________ 1513s 1513s self = 1513s 1513s @requires_dask 1513s def test_write_uneven_dask_chunks(self) -> None: 1513s # regression for GH#2225 1513s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1513s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________________ TestZarrWriteEmpty.test_chunk_encoding[3] ___________________ 1513s 1513s self = 1513s 1513s def test_chunk_encoding(self) -> None: 1513s # These datasets have no dask chunks. All chunking specified in 1513s # encoding 1513s data = create_test_data() 1513s chunks = (5, 5) 1513s data["var2"].encoding.update({"chunks": chunks}) 1513s 1513s > with self.roundtrip(data) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s __________________ TestZarrWriteEmpty.test_shard_encoding[3] ___________________ 1513s 1513s self = 1513s 1513s def test_shard_encoding(self) -> None: 1513s # These datasets have no dask chunks. All chunking/sharding specified in 1513s # encoding 1513s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1513s data = create_test_data() 1513s chunks = (1, 1) 1513s shards = (5, 5) 1513s data["var2"].encoding.update({"chunks": chunks}) 1513s data["var2"].encoding.update({"shards": shards}) 1513s > with self.roundtrip(data) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1513s ___________ TestZarrWriteEmpty.test_write_persistence_modes[3-None] ____________ 1513s 1513s self = 1513s group = None 1513s 1513s @pytest.mark.parametrize("group", [None, "group1"]) 1513s def test_write_persistence_modes(self, group) -> None: 1513s original = create_test_data() 1513s 1513s # overwrite mode 1513s > with self.roundtrip( 1513s original, 1513s save_kwargs={"mode": "w", "group": group}, 1513s open_kwargs={"group": group}, 1513s ) as actual: 1513s 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1513s with self.open(store_target, **open_kwargs) as ds: 1513s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1513s return next(self.gen) 1513s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1513s with xr.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1513s backend_ds = backend.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1513s ds = store_entrypoint.open_dataset( 1513s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1513s vars, attrs = filename_or_obj.load() 1513s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1513s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1513s return Frozen(dict(*args, **kwargs)) 1513s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1513s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1513s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1513s 1513s self = , name = 'dim2' 1513s 1513s def open_store_variable(self, name): 1513s zarr_array = self.members[name] 1513s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1513s try_nczarr = self._mode == "r" 1513s dimensions, attributes = _get_zarr_dims_and_attrs( 1513s zarr_array, DIMENSION_KEY, try_nczarr 1513s ) 1513s attributes = dict(attributes) 1513s 1513s encoding = { 1513s "chunks": zarr_array.chunks, 1513s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1513s } 1513s 1513s if _zarr_v3(): 1513s encoding.update( 1513s { 1513s "compressors": zarr_array.compressors, 1513s "filters": zarr_array.filters, 1513s "shards": zarr_array.shards, 1513s } 1513s ) 1513s if self.zarr_group.metadata.zarr_format == 3: 1513s encoding.update({"serializer": zarr_array.serializer}) 1513s else: 1513s encoding.update( 1513s { 1513s "compressor": zarr_array.compressor, 1513s "filters": zarr_array.filters, 1513s } 1513s ) 1513s 1513s if self._use_zarr_fill_value_as_mask: 1513s # Setting this attribute triggers CF decoding for missing values 1513s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1513s if zarr_array.fill_value is not None: 1513s attributes["_FillValue"] = zarr_array.fill_value 1513s elif "_FillValue" in attributes: 1513s original_zarr_dtype = zarr_array.metadata.data_type 1513s attributes["_FillValue"] = FillValueCoder.decode( 1513s > attributes["_FillValue"], original_zarr_dtype.value 1513s ) 1513s E AttributeError: 'Float64' object has no attribute 'value' 1513s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s __________ TestZarrWriteEmpty.test_write_persistence_modes[3-group1] ___________ 1514s 1514s self = 1514s group = 'group1' 1514s 1514s @pytest.mark.parametrize("group", [None, "group1"]) 1514s def test_write_persistence_modes(self, group) -> None: 1514s original = create_test_data() 1514s 1514s # overwrite mode 1514s > with self.roundtrip( 1514s original, 1514s save_kwargs={"mode": "w", "group": group}, 1514s open_kwargs={"group": group}, 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________ TestZarrWriteEmpty.test_compressor_encoding[3] ________________ 1514s 1514s self = 1514s 1514s def test_compressor_encoding(self) -> None: 1514s # specify a custom compressor 1514s original = create_test_data() 1514s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1514s encoding_key = "compressors" 1514s # all parameters need to be explicitly specified in order for the comparison to pass below 1514s encoding = { 1514s "serializer": zarr.codecs.BytesCodec(endian="little"), 1514s encoding_key: ( 1514s zarr.codecs.BloscCodec( 1514s cname="zstd", 1514s clevel=3, 1514s shuffle="shuffle", 1514s typesize=8, 1514s blocksize=0, 1514s ), 1514s ), 1514s } 1514s else: 1514s from numcodecs.blosc import Blosc 1514s 1514s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1514s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1514s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1514s 1514s save_kwargs = dict(encoding={"var1": encoding}) 1514s 1514s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________________ TestZarrWriteEmpty.test_group[3] _______________________ 1514s 1514s self = 1514s 1514s def test_group(self) -> None: 1514s original = create_test_data() 1514s group = "some/random/path" 1514s > with self.roundtrip( 1514s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________________ TestZarrWriteEmpty.test_append_write[3] ____________________ 1514s 1514s self = 1514s 1514s def test_append_write(self) -> None: 1514s > super().test_append_write() 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1514s with self.roundtrip_append(data) as actual: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1514s self.save(data[[key]], path, mode=mode, **save_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1514s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______ TestZarrWriteEmpty.test_append_with_append_dim_not_set_raises[3] _______ 1514s 1514s self = 1514s 1514s def test_append_with_append_dim_not_set_raises(self) -> None: 1514s ds, ds_to_append, _ = create_append_test_data() 1514s with self.create_zarr_target() as store_target: 1514s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1514s with pytest.raises(ValueError, match="different dimension sizes"): 1514s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'da' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-U] _______ 1514s 1514s self = 1514s dtype = 'U' 1514s 1514s @pytest.mark.parametrize("dtype", ["U", "S"]) 1514s def test_append_string_length_mismatch_works(self, dtype) -> None: 1514s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1514s # ...but it probably would if we used object dtype 1514s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1514s expected = xr.concat([ds, ds_to_append], dim="time") 1514s with self.create_zarr_target() as store_target: 1514s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1514s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1514s _validate_datatypes_for_zarr_append( 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s vname = 'temperature' 1514s existing_var = Size: 96B 1514s [3 values with dtype=>U8] 1514s new_var = Size: 60B 1514s array(['abc', 'def', 'ghijk'], dtype='>U5') 1514s 1514s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1514s """If variable exists in the store, confirm dtype of the data to append is compatible with 1514s existing dtype. 1514s """ 1514s if ( 1514s np.issubdtype(new_var.dtype, np.number) 1514s or np.issubdtype(new_var.dtype, np.datetime64) 1514s or np.issubdtype(new_var.dtype, np.bool_) 1514s or new_var.dtype == object 1514s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1514s ): 1514s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1514s # new to the dataset, because in this case there is no existing var to compare it to; 1514s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1514s # we can be confident appending won't cause problems. Examples of dtypes which are not 1514s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1514s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1514s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1514s f"dataset to append has dtype {new_var.dtype}." 1514s ) 1514s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype >U8 but dataset to append has dtype >U5. 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1514s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-S] _______ 1514s 1514s self = 1514s dtype = 'S' 1514s 1514s @pytest.mark.parametrize("dtype", ["U", "S"]) 1514s def test_append_string_length_mismatch_works(self, dtype) -> None: 1514s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1514s # ...but it probably would if we used object dtype 1514s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1514s expected = xr.concat([ds, ds_to_append], dim="time") 1514s with self.create_zarr_target() as store_target: 1514s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1514s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1514s _validate_datatypes_for_zarr_append( 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s vname = 'temperature' 1514s existing_var = Size: 6B 1514s [3 values with dtype=|S2] 1514s new_var = Size: 9B 1514s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1514s 1514s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1514s """If variable exists in the store, confirm dtype of the data to append is compatible with 1514s existing dtype. 1514s """ 1514s if ( 1514s np.issubdtype(new_var.dtype, np.number) 1514s or np.issubdtype(new_var.dtype, np.datetime64) 1514s or np.issubdtype(new_var.dtype, np.bool_) 1514s or new_var.dtype == object 1514s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1514s ): 1514s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1514s # new to the dataset, because in this case there is no existing var to compare it to; 1514s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1514s # we can be confident appending won't cause problems. Examples of dtypes which are not 1514s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1514s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1514s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1514s f"dataset to append has dtype {new_var.dtype}." 1514s ) 1514s 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. 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1514s _____ TestZarrWriteEmpty.test_check_encoding_is_consistent_after_append[3] _____ 1514s 1514s self = 1514s 1514s def test_check_encoding_is_consistent_after_append(self) -> None: 1514s ds, ds_to_append, _ = create_append_test_data() 1514s 1514s # check encoding consistency 1514s with self.create_zarr_target() as store_target: 1514s import numcodecs 1514s 1514s encoding_value: Any 1514s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1514s compressor = zarr.codecs.BloscCodec() 1514s else: 1514s compressor = numcodecs.Blosc() 1514s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1514s encoding_value = (compressor,) if has_zarr_v3 else compressor 1514s 1514s encoding = {"da": {encoding_key: encoding_value}} 1514s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1514s > original_ds = xr.open_dataset( 1514s store_target, engine="zarr", **self.version_kwargs 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'da' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________ TestZarrWriteEmpty.test_append_with_new_variable[3] ______________ 1514s 1514s self = 1514s 1514s def test_append_with_new_variable(self) -> None: 1514s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1514s 1514s # check append mode for new variable 1514s with self.create_zarr_target() as store_target: 1514s combined = xr.concat([ds, ds_to_append], dim="time") 1514s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1514s assert_identical( 1514s combined, 1514s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'da' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_append_with_append_dim_no_overwrite[3] ________ 1514s 1514s self = 1514s 1514s def test_append_with_append_dim_no_overwrite(self) -> None: 1514s ds, ds_to_append, _ = create_append_test_data() 1514s with self.create_zarr_target() as store_target: 1514s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1514s original = xr.concat([ds, ds_to_append], dim="time") 1514s original2 = xr.concat([original, ds_to_append], dim="time") 1514s 1514s # overwrite a coordinate; 1514s # for mode='a-', this will not get written to the store 1514s # because it does not have the append_dim as a dim 1514s lon = ds_to_append.lon.to_numpy().copy() 1514s lon[:] = -999 1514s ds_to_append["lon"] = lon 1514s > ds_to_append.to_zarr( 1514s store_target, mode="a-", append_dim="time", **self.version_kwargs 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'da' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s __________ TestZarrWriteEmpty.test_to_zarr_compute_false_roundtrip[3] __________ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_to_zarr_compute_false_roundtrip(self) -> None: 1514s from dask.delayed import Delayed 1514s 1514s original = create_test_data().chunk() 1514s 1514s with self.create_zarr_target() as store: 1514s delayed_obj = self.save(original, store, compute=False) 1514s assert isinstance(delayed_obj, Delayed) 1514s 1514s # make sure target store has not been written to yet 1514s with pytest.raises(AssertionError): 1514s > with self.open(store) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______ TestZarrWriteEmpty.test_to_zarr_append_compute_false_roundtrip[3] _______ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1514s from dask.delayed import Delayed 1514s 1514s ds, ds_to_append, _ = create_append_test_data() 1514s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1514s 1514s with pytest.warns(SerializationWarning): 1514s with self.create_zarr_target() as store: 1514s delayed_obj = self.save(ds, store, compute=False, mode="w") 1514s assert isinstance(delayed_obj, Delayed) 1514s 1514s with pytest.raises(AssertionError): 1514s > with self.open(store) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'da' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________ TestZarrWriteEmpty.test_save_emptydim[3-False] ________________ 1514s 1514s self = 1514s chunk = False 1514s 1514s @pytest.mark.parametrize("chunk", [False, True]) 1514s def test_save_emptydim(self, chunk) -> None: 1514s if chunk and not has_dask: 1514s pytest.skip("requires dask") 1514s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1514s if chunk: 1514s ds = ds.chunk({}) # chunk dataset to save dask array 1514s > with self.roundtrip(ds) as ds_reload: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'x' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________ TestZarrWriteEmpty.test_save_emptydim[3-True] _________________ 1514s 1514s self = 1514s chunk = True 1514s 1514s @pytest.mark.parametrize("chunk", [False, True]) 1514s def test_save_emptydim(self, chunk) -> None: 1514s if chunk and not has_dask: 1514s pytest.skip("requires dask") 1514s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1514s if chunk: 1514s ds = ds.chunk({}) # chunk dataset to save dask array 1514s > with self.roundtrip(ds) as ds_reload: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'x' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____ TestZarrWriteEmpty.test_no_warning_from_open_emptydim_with_chunks[3] _____ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1514s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1514s with assert_no_warnings(): 1514s with warnings.catch_warnings(): 1514s warnings.filterwarnings( 1514s "ignore", 1514s message=".*Zarr format 3 specification.*", 1514s category=UserWarning, 1514s ) 1514s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'x' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______ TestZarrWriteEmpty.test_write_region[3-False-False-False-False] ________ 1514s 1514s self = 1514s consolidated = False, compute = False, use_dask = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-True] ________ 1514s 1514s self = 1514s consolidated = True, compute = False, use_dask = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-None] ________ 1514s 1514s self = 1514s consolidated = None, compute = False, use_dask = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-False] ________ 1514s 1514s self = 1514s consolidated = False, compute = True, use_dask = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = True, use_dask = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = True, use_dask = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-False] ________ 1514s 1514s self = 1514s consolidated = False, compute = False, use_dask = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = False, use_dask = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = False, use_dask = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-False-True-True-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = True, use_dask = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = True, use_dask = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = True, use_dask = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-False] ________ 1514s 1514s self = 1514s consolidated = False, compute = False, use_dask = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = False, use_dask = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = False, use_dask = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-True-False-True-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = True, use_dask = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = True, use_dask = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = True, use_dask = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-True-True-False-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = False, use_dask = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = False, use_dask = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = False, use_dask = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = True, use_dask = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-True] __________ 1514s 1514s self = 1514s consolidated = True, compute = True, use_dask = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-None] __________ 1514s 1514s self = 1514s consolidated = None, compute = True, use_dask = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-False] ________ 1514s 1514s self = 1514s consolidated = False, compute = False, use_dask = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = False, use_dask = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = False, use_dask = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-None-False-True-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = True, use_dask = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = True, use_dask = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = True, use_dask = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_region[3-None-True-False-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = False, use_dask = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-True] _________ 1514s 1514s self = 1514s consolidated = True, compute = False, use_dask = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-None] _________ 1514s 1514s self = 1514s consolidated = None, compute = False, use_dask = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s assert_identical(actual, zeros) 1514s for i in range(0, 10, 2): 1514s region = {"x": slice(i, i + 2)} 1514s > nonzeros.isel(region).to_zarr( 1514s store, 1514s region=region, 1514s consolidated=consolidated, 1514s write_empty_chunks=write_empty, 1514s **self.version_kwargs, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-False] _________ 1514s 1514s self = 1514s consolidated = False, compute = True, use_dask = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-True] __________ 1514s 1514s self = 1514s consolidated = True, compute = True, use_dask = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-None] __________ 1514s 1514s self = 1514s consolidated = None, compute = True, use_dask = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [False, True, None]) 1514s @pytest.mark.parametrize("compute", [False, True]) 1514s @pytest.mark.parametrize("use_dask", [False, True]) 1514s @pytest.mark.parametrize("write_empty", [False, True, None]) 1514s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1514s if (use_dask or not compute) and not has_dask: 1514s pytest.skip("requires dask") 1514s 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s 1514s if use_dask: 1514s zeros = zeros.chunk(2) 1514s nonzeros = nonzeros.chunk(2) 1514s 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr( 1514s store, 1514s consolidated=consolidated, 1514s compute=compute, 1514s encoding={"u": dict(chunks=2)}, 1514s **self.version_kwargs, 1514s ) 1514s if compute: 1514s > with xr.open_zarr( 1514s store, consolidated=consolidated, **self.version_kwargs 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_region_mode[3-None] _______________ 1514s 1514s self = 1514s mode = None 1514s 1514s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1514s def test_write_region_mode(self, mode) -> None: 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr(store, **self.version_kwargs) 1514s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1514s > nonzeros.isel(region).to_zarr( 1514s store, region=region, mode=mode, **self.version_kwargs 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________ TestZarrWriteEmpty.test_write_region_mode[3-r+] ________________ 1514s 1514s self = 1514s mode = 'r+' 1514s 1514s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1514s def test_write_region_mode(self, mode) -> None: 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr(store, **self.version_kwargs) 1514s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1514s > nonzeros.isel(region).to_zarr( 1514s store, region=region, mode=mode, **self.version_kwargs 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________ TestZarrWriteEmpty.test_write_region_mode[3-a] ________________ 1514s 1514s self = 1514s mode = 'a' 1514s 1514s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1514s def test_write_region_mode(self, mode) -> None: 1514s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1514s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1514s with self.create_zarr_target() as store: 1514s zeros.to_zarr(store, **self.version_kwargs) 1514s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1514s > nonzeros.isel(region).to_zarr( 1514s store, region=region, mode=mode, **self.version_kwargs 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrWriteEmpty.test_write_preexisting_override_metadata[3] ________ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_write_preexisting_override_metadata(self) -> None: 1514s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1514s original = Dataset( 1514s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1514s attrs={"global": "original"}, 1514s ) 1514s both_modified = Dataset( 1514s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1514s attrs={"global": "modified"}, 1514s ) 1514s global_modified = Dataset( 1514s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1514s attrs={"global": "modified"}, 1514s ) 1514s only_new_data = Dataset( 1514s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1514s attrs={"global": "original"}, 1514s ) 1514s 1514s with self.create_zarr_target() as store: 1514s original.to_zarr(store, compute=False, **self.version_kwargs) 1514s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'u' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________ TestZarrWriteEmpty.test_encoding_chunksizes[3] ________________ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_encoding_chunksizes(self) -> None: 1514s # regression test for GH2278 1514s # see also test_encoding_chunksizes_unlimited 1514s nx, ny, nt = 4, 4, 5 1514s original = xr.Dataset( 1514s {}, 1514s coords={ 1514s "x": np.arange(nx), 1514s "y": np.arange(ny), 1514s "t": np.arange(nt), 1514s }, 1514s ) 1514s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1514s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1514s 1514s > with self.roundtrip(original) as ds1: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'v' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______ TestZarrWriteEmpty.test_chunk_encoding_with_partial_dask_chunks[3] ______ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1514s original = xr.Dataset( 1514s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1514s ).chunk({"a": 3}) 1514s 1514s > with self.roundtrip( 1514s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1514s ) as ds1: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'x' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________ TestZarrWriteEmpty.test_open_zarr_use_cftime[3] ________________ 1514s 1514s self = 1514s 1514s @requires_cftime 1514s def test_open_zarr_use_cftime(self) -> None: 1514s ds = create_test_data() 1514s with self.create_zarr_target() as store_target: 1514s ds.to_zarr(store_target, **self.version_kwargs) 1514s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_read_select_write[3] ______________ 1514s 1514s self = 1514s 1514s def test_write_read_select_write(self) -> None: 1514s # Test for https://github.com/pydata/xarray/issues/4084 1514s ds = create_test_data() 1514s 1514s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1514s with self.create_zarr_target() as initial_store: 1514s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1514s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s __________________ TestZarrWriteEmpty.test_attributes[3-obj1] __________________ 1514s 1514s self = 1514s obj = Size: 8B 1514s array(nan) 1514s Attributes: 1514s good: {'key': 'value'} 1514s 1514s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1514s def test_attributes(self, obj) -> None: 1514s obj = obj.copy() 1514s 1514s obj.attrs["good"] = {"key": "value"} 1514s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1514s with self.create_zarr_target() as store_target: 1514s ds.to_zarr(store_target, **self.version_kwargs) 1514s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'foo' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1514s 1514s self = 1514s dtype = 'datetime64[ns]' 1514s 1514s @requires_dask 1514s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1514s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1514s # Generalized from @malmans2's test in PR #8253 1514s original = create_test_data().astype(dtype).chunk(1) 1514s > with self.roundtrip( 1514s original, 1514s open_kwargs={ 1514s "chunks": {}, 1514s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1514s }, 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1514s 1514s self = 1514s dtype = 'timedelta64[ns]' 1514s 1514s @requires_dask 1514s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1514s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1514s # Generalized from @malmans2's test in PR #8253 1514s original = create_test_data().astype(dtype).chunk(1) 1514s > with self.roundtrip( 1514s original, 1514s open_kwargs={ 1514s "chunks": {}, 1514s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1514s }, 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________ TestZarrWriteEmpty.test_zarr_fill_value_setting[3-float] ___________ 1514s 1514s self = 1514s dtype = 1514s 1514s @requires_dask 1514s @pytest.mark.parametrize("dtype", [int, float]) 1514s def test_zarr_fill_value_setting(self, dtype): 1514s # When zarr_format=2, _FillValue sets fill_value 1514s # When zarr_format=3, fill_value is set independently 1514s # We test this by writing a dask array with compute=False, 1514s # on read we should receive chunks filled with `fill_value` 1514s fv = -1 1514s ds = xr.Dataset( 1514s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1514s ) 1514s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1514s 1514s zarr_format_2 = ( 1514s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1514s ) or not has_zarr_v3 1514s if zarr_format_2: 1514s attr = "_FillValue" 1514s expected.foo.attrs[attr] = fv 1514s else: 1514s attr = "fill_value" 1514s if dtype is float: 1514s # for floats, Xarray inserts a default `np.nan` 1514s expected.foo.attrs["_FillValue"] = np.nan 1514s 1514s # turn off all decoding so we see what Zarr returns to us. 1514s # Since chunks, are not written, we should receive on `fill_value` 1514s open_kwargs = { 1514s "mask_and_scale": False, 1514s "consolidated": False, 1514s "use_zarr_fill_value_as_mask": False, 1514s } 1514s save_kwargs = dict(compute=False, consolidated=False) 1514s > with self.roundtrip( 1514s ds, 1514s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1514s open_kwargs=open_kwargs, 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1514s with self.open(store_target, **open_kwargs) as ds: 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1514s with xr.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'foo' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________ TestZarrWriteEmpty.test_write_empty[3-True-True] _______________ 1514s 1514s self = 1514s consolidated = True, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_empty[3-True-False] _______________ 1514s 1514s self = 1514s consolidated = False, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________ TestZarrWriteEmpty.test_write_empty[3-True-None] _______________ 1514s 1514s self = 1514s consolidated = None, write_empty = True 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_empty[3-False-True] _______________ 1514s 1514s self = 1514s consolidated = True, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_empty[3-False-False] ______________ 1514s 1514s self = 1514s consolidated = False, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_empty[3-False-None] _______________ 1514s 1514s self = 1514s consolidated = None, write_empty = False 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________ TestZarrWriteEmpty.test_write_empty[3-None-True] _______________ 1514s 1514s self = 1514s consolidated = True, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrWriteEmpty.test_write_empty[3-None-False] _______________ 1514s 1514s self = 1514s consolidated = False, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________ TestZarrWriteEmpty.test_write_empty[3-None-None] _______________ 1514s 1514s self = 1514s consolidated = None, write_empty = None 1514s 1514s @pytest.mark.parametrize("consolidated", [True, False, None]) 1514s @pytest.mark.parametrize("write_empty", [True, False, None]) 1514s def test_write_empty( 1514s self, 1514s consolidated: bool | None, 1514s write_empty: bool | None, 1514s ) -> None: 1514s def assert_expected_files(expected: list[str], store: str) -> None: 1514s """Convenience for comparing with actual files written""" 1514s ls = [] 1514s test_root = os.path.join(store, "test") 1514s for root, _, files in os.walk(test_root): 1514s ls.extend( 1514s [ 1514s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1514s for f in files 1514s ] 1514s ) 1514s 1514s assert set(expected) == set( 1514s [ 1514s file.lstrip("c/") 1514s for file in ls 1514s if (file not in (".zattrs", ".zarray", "zarr.json")) 1514s ] 1514s ) 1514s 1514s # The zarr format is set by the `default_zarr_format` 1514s # pytest fixture that acts on a superclass 1514s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1514s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1514s expected = ["0.1.0"] 1514s else: 1514s expected = [ 1514s "0.0.0", 1514s "0.0.1", 1514s "0.1.0", 1514s "0.1.1", 1514s ] 1514s 1514s if zarr_format_3: 1514s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1514s # transform to the path style of zarr 3 1514s # e.g. 0/0/1 1514s expected = [e.replace(".", "/") for e in expected] 1514s else: 1514s # use nan for default fill_value behaviour 1514s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1514s 1514s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1514s 1514s if has_dask: 1514s ds["test"] = ds["test"].chunk(1) 1514s encoding = None 1514s else: 1514s encoding = {"test": {"chunks": (1, 1, 1)}} 1514s 1514s with self.temp_dir() as (d, store): 1514s ds.to_zarr( 1514s store, 1514s mode="w", 1514s encoding=encoding, 1514s write_empty_chunks=write_empty, 1514s ) 1514s 1514s # check expected files after a write 1514s assert_expected_files(expected, store) 1514s 1514s > with self.roundtrip_dir( 1514s ds, 1514s store, 1514s save_kwargs={ 1514s "mode": "a", 1514s "append_dim": "Z", 1514s "write_empty_chunks": write_empty, 1514s }, 1514s ) as a_ds: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1514s return next(self.gen) 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1514s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-full-auto] _____________ 1514s 1514s self = 1514s region = 'auto' 1514s 1514s @pytest.mark.parametrize( 1514s "region", 1514s [ 1514s pytest.param("auto", id="full-auto"), 1514s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1514s ], 1514s ) 1514s def test_zarr_region_auto(self, region): 1514s with self.create() as (target, ds): 1514s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1514s > self.save(target, ds_region, region=region) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-mixed-auto] ____________ 1514s 1514s self = 1514s region = {'x': slice(np.int64(2), np.int64(4), None), 'y': slice(6, 8, None)} 1514s 1514s @pytest.mark.parametrize( 1514s "region", 1514s [ 1514s pytest.param("auto", id="full-auto"), 1514s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1514s ], 1514s ) 1514s def test_zarr_region_auto(self, region): 1514s with self.create() as (target, ds): 1514s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1514s > self.save(target, ds_region, region=region) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrRegionAuto.test_zarr_region_index_write[3] ______________ 1514s 1514s self = 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_zarr_region_index_write_30') 1514s 1514s def test_zarr_region_index_write(self, tmp_path): 1514s region: Mapping[str, slice] | Literal["auto"] 1514s region_slice = dict(x=slice(2, 4), y=slice(6, 8)) 1514s 1514s with self.create() as (target, ds): 1514s ds_region = 1 + ds.isel(region_slice) 1514s for region in [region_slice, "auto"]: # type: ignore[assignment] 1514s with patch.object( 1514s ZarrStore, 1514s "set_variables", 1514s side_effect=ZarrStore.set_variables, 1514s autospec=True, 1514s ) as mock: 1514s > self.save(target, ds_region, region=region, mode="r+") 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6336: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ____________________ TestZarrRegionAuto.test_zarr_region[3] ____________________ 1514s 1514s self = 1514s 1514s def test_zarr_region(self): 1514s with self.create() as (target, ds): 1514s ds_transposed = ds.transpose("y", "x") 1514s ds_region = 1 + ds_transposed.isel(x=[0], y=[0]) 1514s > self.save(target, ds_region, region={"x": slice(0, 1), "y": slice(0, 1)}) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6369: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________ TestZarrRegionAuto.test_zarr_append_chunk_partial[3] _____________ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_zarr_append_chunk_partial(self): 1514s t_coords = np.array([np.datetime64("2020-01-01").astype("datetime64[ns]")]) 1514s data = np.ones((10, 10)) 1514s 1514s da = xr.DataArray( 1514s data.reshape((-1, 10, 10)), 1514s dims=["time", "x", "y"], 1514s coords={"time": t_coords}, 1514s name="foo", 1514s ) 1514s new_time = np.array([np.datetime64("2021-01-01").astype("datetime64[ns]")]) 1514s da2 = xr.DataArray( 1514s data.reshape((-1, 10, 10)), 1514s dims=["time", "x", "y"], 1514s coords={"time": new_time}, 1514s name="foo", 1514s ) 1514s 1514s with self.create_zarr_target() as target: 1514s self.save(target, da, mode="w", encoding={"foo": {"chunks": (5, 5, 1)}}) 1514s 1514s with pytest.raises(ValueError, match="encoding was provided"): 1514s self.save( 1514s target, 1514s da2, 1514s append_dim="time", 1514s mode="a", 1514s encoding={"foo": {"chunks": (1, 1, 1)}}, 1514s ) 1514s 1514s # chunking with dask sidesteps the encoding check, so we need a different check 1514s with pytest.raises(ValueError, match="Specified zarr chunks"): 1514s > self.save( 1514s target, 1514s da2.chunk({"x": 1, "y": 1, "time": 1}), 1514s append_dim="time", 1514s mode="a", 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6426: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'foo' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrRegionAuto.test_zarr_region_chunk_partial_offset[3] __________ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_zarr_region_chunk_partial_offset(self): 1514s # https://github.com/pydata/xarray/pull/8459#issuecomment-1819417545 1514s with self.create_zarr_target() as store: 1514s data = np.ones((30,)) 1514s da = xr.DataArray( 1514s data, dims=["x"], coords={"x": range(30)}, name="foo" 1514s ).chunk(x=10) 1514s self.save(store, da, compute=False) 1514s 1514s > self.save(store, da.isel(x=slice(10)).chunk(x=(10,)), region="auto") 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6443: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'foo' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ____________ TestZarrRegionAuto.test_zarr_safe_chunk_append_dim[3] _____________ 1514s 1514s self = 1514s 1514s @requires_dask 1514s def test_zarr_safe_chunk_append_dim(self): 1514s with self.create_zarr_target() as store: 1514s data = np.ones((20,)) 1514s da = xr.DataArray( 1514s data, dims=["x"], coords={"x": range(20)}, name="foo" 1514s ).chunk(x=5) 1514s 1514s self.save(store, da.isel(x=slice(0, 7)), safe_chunks=True, mode="w") 1514s with pytest.raises(ValueError): 1514s # If the first chunk is smaller than the border size then raise an error 1514s > self.save( 1514s store, 1514s da.isel(x=slice(7, 11)).chunk(x=(2, 2)), 1514s append_dim="x", 1514s safe_chunks=True, 1514s ) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6468: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'foo' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-r+] _____________ 1514s 1514s self = 1514s mode = 'r+' 1514s 1514s @requires_dask 1514s @pytest.mark.parametrize("mode", ["r+", "a"]) 1514s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1514s with self.create_zarr_target() as store: 1514s arr = xr.DataArray( 1514s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1514s ).chunk(a=3) 1514s self.save(store, arr, mode="w") 1514s 1514s with pytest.raises(ValueError): 1514s # There are two Dask chunks on the same Zarr chunk, 1514s # which means that it is unsafe in any mode 1514s self.save( 1514s store, 1514s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1514s region="auto", 1514s mode=mode, 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # the first chunk is covering the border size, but it is not 1514s # completely covering the second chunk, which means that it is 1514s # unsafe in any mode 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1514s region="auto", 1514s mode=mode, 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # The first chunk is safe but the other two chunks are overlapping with 1514s # the same Zarr chunk 1514s self.save( 1514s store, 1514s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1514s region="auto", 1514s mode=mode, 1514s ) 1514s 1514s # Fully update two contiguous chunks is safe in any mode 1514s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1514s 1514s # The last chunk is considered full based on their current size (2) 1514s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1514s self.save( 1514s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1514s ) 1514s 1514s # Write the last chunk of a region partially is safe in "a" mode 1514s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1514s with pytest.raises(ValueError): 1514s # with "r+" mode it is invalid to write partial chunk 1514s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1514s 1514s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1514s self.save( 1514s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1514s ) 1514s with pytest.raises(ValueError): 1514s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s # This is safe on mode "a" because there is a single dask chunk 1514s self.save( 1514s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1514s ) 1514s with pytest.raises(ValueError): 1514s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1514s # in the first chunk of Zarr 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s # The first chunk is completely covering the first Zarr chunk 1514s # and the last chunk is a partial one 1514s self.save( 1514s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # The last chunk is partial, so it is considered unsafe on mode "r+" 1514s self.save( 1514s store, 1514s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s # The first chunk is covering the border size (2 elements) 1514s # and also the second chunk (3 elements), so it is valid 1514s self.save( 1514s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # The first chunk is not fully covering the first zarr chunk 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # Validate that the border condition is not affecting the "r+" mode 1514s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1514s 1514s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1514s with pytest.raises(ValueError): 1514s # Validate that even if we write with a single Dask chunk on the last Zarr 1514s # chunk it is still unsafe if it is not fully covering it 1514s # (the last Zarr chunk has size 2) 1514s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1514s 1514s # Validate the same as the above test but in the beginning of the last chunk 1514s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1514s with pytest.raises(ValueError): 1514s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1514s 1514s self.save( 1514s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1514s ) 1514s with pytest.raises(ValueError): 1514s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1514s # if it is partial covering other Zarr chunks 1514s self.save( 1514s store, 1514s arr.isel(a=slice(7, None)).chunk(a=-1), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # If the chunk is of size equal to the one in the Zarr encoding, but 1514s # it is partially writing in the first chunk then raise an error 1514s self.save( 1514s store, 1514s arr.isel(a=slice(8, None)).chunk(a=3), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s self.save( 1514s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1514s ) 1514s 1514s # Test if the code is detecting the last chunk correctly 1514s data = np.random.default_rng(0).random((2920, 25, 53)) 1514s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1514s chunks = {"time": 1000, "lat": 25, "lon": 53} 1514s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1514s region = {"time": slice(1000, 2000, 1)} 1514s chunk = ds.isel(region) 1514s chunk = chunk.chunk() 1514s > self.save(store, chunk.chunk(), region=region) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = 1514s name = 'temperature' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-a] ______________ 1514s 1514s self = 1514s mode = 'a' 1514s 1514s @requires_dask 1514s @pytest.mark.parametrize("mode", ["r+", "a"]) 1514s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1514s with self.create_zarr_target() as store: 1514s arr = xr.DataArray( 1514s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1514s ).chunk(a=3) 1514s self.save(store, arr, mode="w") 1514s 1514s with pytest.raises(ValueError): 1514s # There are two Dask chunks on the same Zarr chunk, 1514s # which means that it is unsafe in any mode 1514s self.save( 1514s store, 1514s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1514s region="auto", 1514s mode=mode, 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # the first chunk is covering the border size, but it is not 1514s # completely covering the second chunk, which means that it is 1514s # unsafe in any mode 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1514s region="auto", 1514s mode=mode, 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # The first chunk is safe but the other two chunks are overlapping with 1514s # the same Zarr chunk 1514s self.save( 1514s store, 1514s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1514s region="auto", 1514s mode=mode, 1514s ) 1514s 1514s # Fully update two contiguous chunks is safe in any mode 1514s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1514s 1514s # The last chunk is considered full based on their current size (2) 1514s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1514s self.save( 1514s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1514s ) 1514s 1514s # Write the last chunk of a region partially is safe in "a" mode 1514s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1514s with pytest.raises(ValueError): 1514s # with "r+" mode it is invalid to write partial chunk 1514s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1514s 1514s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1514s self.save( 1514s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1514s ) 1514s with pytest.raises(ValueError): 1514s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s # This is safe on mode "a" because there is a single dask chunk 1514s self.save( 1514s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1514s ) 1514s with pytest.raises(ValueError): 1514s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1514s # in the first chunk of Zarr 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s # The first chunk is completely covering the first Zarr chunk 1514s # and the last chunk is a partial one 1514s self.save( 1514s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # The last chunk is partial, so it is considered unsafe on mode "r+" 1514s self.save( 1514s store, 1514s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s # The first chunk is covering the border size (2 elements) 1514s # and also the second chunk (3 elements), so it is valid 1514s self.save( 1514s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # The first chunk is not fully covering the first zarr chunk 1514s self.save( 1514s store, 1514s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # Validate that the border condition is not affecting the "r+" mode 1514s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1514s 1514s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1514s with pytest.raises(ValueError): 1514s # Validate that even if we write with a single Dask chunk on the last Zarr 1514s # chunk it is still unsafe if it is not fully covering it 1514s # (the last Zarr chunk has size 2) 1514s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1514s 1514s # Validate the same as the above test but in the beginning of the last chunk 1514s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1514s with pytest.raises(ValueError): 1514s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1514s 1514s self.save( 1514s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1514s ) 1514s with pytest.raises(ValueError): 1514s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1514s # if it is partial covering other Zarr chunks 1514s self.save( 1514s store, 1514s arr.isel(a=slice(7, None)).chunk(a=-1), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s # If the chunk is of size equal to the one in the Zarr encoding, but 1514s # it is partially writing in the first chunk then raise an error 1514s self.save( 1514s store, 1514s arr.isel(a=slice(8, None)).chunk(a=3), 1514s region="auto", 1514s mode="r+", 1514s ) 1514s 1514s with pytest.raises(ValueError): 1514s self.save( 1514s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1514s ) 1514s 1514s # Test if the code is detecting the last chunk correctly 1514s data = np.random.default_rng(0).random((2920, 25, 53)) 1514s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1514s chunks = {"time": 1000, "lat": 25, "lon": 53} 1514s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1514s region = {"time": slice(1000, 2000, 1)} 1514s chunk = ds.isel(region) 1514s chunk = chunk.chunk() 1514s > self.save(store, chunk.chunk(), region=region) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1514s ds.to_zarr(target, **kwargs) 1514s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1514s return to_zarr( # type: ignore[call-overload,misc] 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1514s dump_to_store(dataset, zstore, writer, encoding=encoding) 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1514s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1514s k: self.open_store_variable(name=k) for k in existing_variable_names 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = 1514s name = 'temperature' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ____________________ test_open_dataset_chunking_zarr[auto] _____________________ 1514s 1514s chunks = 'auto' 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar0') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1514s encoded_chunks = 100 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________________ test_open_dataset_chunking_zarr[-1] ______________________ 1514s 1514s chunks = -1 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar1') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1514s encoded_chunks = 100 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________________ test_open_dataset_chunking_zarr[chunks2] ___________________ 1514s 1514s chunks = {} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar2') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1514s encoded_chunks = 100 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________________ test_open_dataset_chunking_zarr[chunks3] ___________________ 1514s 1514s chunks = {'x': 'auto'} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar3') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1514s encoded_chunks = 100 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________________ test_open_dataset_chunking_zarr[chunks4] ___________________ 1514s 1514s chunks = {'x': -1} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar4') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1514s encoded_chunks = 100 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________________ test_open_dataset_chunking_zarr[chunks5] ___________________ 1514s 1514s chunks = {'x': 'auto', 'y': -1} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar5') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1514s encoded_chunks = 100 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _______________________ test_chunking_consintency[auto] ________________________ 1514s 1514s chunks = 'auto' 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_auto0') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1514s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1514s encoded_chunks: dict[str, Any] = {} 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s ds.to_netcdf(tmp_path / "test.nc") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with xr.open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________________ test_chunking_consintency[-1] _________________________ 1514s 1514s chunks = -1 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency__1_0') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1514s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1514s encoded_chunks: dict[str, Any] = {} 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s ds.to_netcdf(tmp_path / "test.nc") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with xr.open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________________ test_chunking_consintency[chunks2] ______________________ 1514s 1514s chunks = {} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun0') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1514s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1514s encoded_chunks: dict[str, Any] = {} 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s ds.to_netcdf(tmp_path / "test.nc") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with xr.open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________________ test_chunking_consintency[chunks3] ______________________ 1514s 1514s chunks = {'x': 'auto'} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun1') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1514s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1514s encoded_chunks: dict[str, Any] = {} 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s ds.to_netcdf(tmp_path / "test.nc") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with xr.open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________________ test_chunking_consintency[chunks4] ______________________ 1514s 1514s chunks = {'x': -1} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun2') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1514s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1514s encoded_chunks: dict[str, Any] = {} 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s ds.to_netcdf(tmp_path / "test.nc") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with xr.open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________________ test_chunking_consintency[chunks5] ______________________ 1514s 1514s chunks = {'x': 'auto', 'y': -1} 1514s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun3') 1514s 1514s @requires_zarr 1514s @requires_dask 1514s @pytest.mark.parametrize( 1514s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1514s ) 1514s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1514s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1514s encoded_chunks: dict[str, Any] = {} 1514s dask_arr = da.from_array( 1514s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1514s ) 1514s ds = xr.Dataset( 1514s { 1514s "test": xr.DataArray( 1514s dask_arr, 1514s dims=("x", "y"), 1514s ) 1514s } 1514s ) 1514s ds["test"].encoding["chunks"] = encoded_chunks 1514s ds.to_zarr(tmp_path / "test.zarr") 1514s ds.to_netcdf(tmp_path / "test.nc") 1514s 1514s with dask.config.set({"array.chunk-size": "1MiB"}): 1514s expected = ds.chunk(chunks) 1514s > with xr.open_dataset( 1514s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1514s ) as actual: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'test' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________________ TestNCZarr.test_overwriting_nczarr ______________________ 1514s 1514s self = 1514s 1514s def test_overwriting_nczarr(self) -> None: 1514s with create_tmp_file(suffix=".zarr") as tmp: 1514s ds = self._create_nczarr(tmp) 1514s expected = ds[["var1"]] 1514s expected.to_zarr(tmp, mode="w") 1514s > actual = xr.open_zarr(tmp, consolidated=False) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6223: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1514s ds = open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1514s backend_ds = backend.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1514s ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'dim2' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________________ TestZarrDatatreeIO.test_to_zarr[zarr_format=3] ________________ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zarr_format_3_0') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s zarr_format = 3 1514s 1514s def test_to_zarr(self, tmpdir, simple_datatree, zarr_format): 1514s filepath = str(tmpdir / "test.zarr") 1514s original_dt = simple_datatree 1514s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1514s 1514s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:459: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________ TestZarrDatatreeIO.test_zarr_encoding[zarr_format=3] _____________ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_zarr_encoding_zarr_format1') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s zarr_format = 3 1514s 1514s def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format): 1514s filepath = str(tmpdir / "test.zarr") 1514s original_dt = simple_datatree 1514s 1514s if zarr_format == 2: 1514s from numcodecs.blosc import Blosc 1514s 1514s codec = Blosc(cname="zstd", clevel=3, shuffle=2) 1514s comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec} 1514s elif zarr_format == 3: 1514s # specifying codecs in zarr_format=3 requires importing from zarr 3 namespace 1514s import numcodecs.zarr3 1514s 1514s comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)} 1514s 1514s enc = {"/set2": {var: comp for var in original_dt["/set2"].dataset.data_vars}} 1514s original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format) 1514s 1514s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:480: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=2] ___________ 1514s 1514s cls = 1514s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1514s path = '', mode = 'r' 1514s 1514s @classmethod 1514s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1514s """ 1514s Open StorePath based on the provided mode. 1514s 1514s * If the mode is None, return an opened version of the store with no changes. 1514s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1514s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1514s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1514s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1514s 1514s Parameters 1514s ---------- 1514s mode : AccessModeLiteral 1514s The mode to use when initializing the store path. 1514s 1514s The accepted values are: 1514s 1514s - ``'r'``: read only (must exist) 1514s - ``'r+'``: read/write (must exist) 1514s - ``'a'``: read/write (create if doesn't exist) 1514s - ``'w'``: read/write (overwrite if exists) 1514s - ``'w-'``: read/write (create if doesn't exist). 1514s 1514s Raises 1514s ------ 1514s FileExistsError 1514s If the mode is 'w-' and the store path already exists. 1514s ValueError 1514s If the mode is not "r" and the store is read-only, or 1514s """ 1514s 1514s # fastpath if mode is None 1514s if mode is None: 1514s return await cls._create_open_instance(store, path) 1514s 1514s if mode not in ANY_ACCESS_MODE: 1514s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1514s 1514s if store.read_only: 1514s # Don't allow write operations on a read-only store 1514s if mode != "r": 1514s raise ValueError( 1514s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1514s ) 1514s self = await cls._create_open_instance(store, path) 1514s elif mode == "r": 1514s # Create read-only copy for read mode on writable store 1514s try: 1514s > read_only_store = store.with_read_only(True) 1514s 1514s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1514s read_only = True 1514s 1514s def with_read_only(self, read_only: bool = False) -> Store: 1514s """ 1514s Return a new store with a new read_only setting. 1514s 1514s The new store points to the same location with the specified new read_only state. 1514s The returned Store is not automatically opened, and this store is 1514s not automatically closed. 1514s 1514s Parameters 1514s ---------- 1514s read_only 1514s If True, the store will be created in read-only mode. Defaults to False. 1514s 1514s Returns 1514s ------- 1514s A new store of the same type with the new read only attribute. 1514s """ 1514s > raise NotImplementedError( 1514s f"with_read_only is not implemented for the {type(self)} store type." 1514s ) 1514s E NotImplementedError: with_read_only is not implemented for the store type. 1514s 1514s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1514s 1514s The above exception was the direct cause of the following exception: 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s zarr_format = 2 1514s 1514s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1514s from zarr.storage import ZipStore 1514s 1514s filepath = str(tmpdir / "test.zarr.zip") 1514s original_dt = simple_datatree 1514s store = ZipStore(filepath, mode="w") 1514s original_dt.to_zarr(store, zarr_format=zarr_format) 1514s 1514s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1514s stores = ZarrStore.open_store( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1514s ) = _get_open_params( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1514s zarr_root_group = zarr.open_group(store, **open_kwargs) 1514s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1514s sync( 1514s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1514s raise return_result 1514s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1514s return await coro 1514s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1514s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1514s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1514s return await StorePath.open(store, path=path_normalized, mode=mode) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s cls = 1514s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1514s path = '', mode = 'r' 1514s 1514s @classmethod 1514s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1514s """ 1514s Open StorePath based on the provided mode. 1514s 1514s * If the mode is None, return an opened version of the store with no changes. 1514s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1514s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1514s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1514s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1514s 1514s Parameters 1514s ---------- 1514s mode : AccessModeLiteral 1514s The mode to use when initializing the store path. 1514s 1514s The accepted values are: 1514s 1514s - ``'r'``: read only (must exist) 1514s - ``'r+'``: read/write (must exist) 1514s - ``'a'``: read/write (create if doesn't exist) 1514s - ``'w'``: read/write (overwrite if exists) 1514s - ``'w-'``: read/write (create if doesn't exist). 1514s 1514s Raises 1514s ------ 1514s FileExistsError 1514s If the mode is 'w-' and the store path already exists. 1514s ValueError 1514s If the mode is not "r" and the store is read-only, or 1514s """ 1514s 1514s # fastpath if mode is None 1514s if mode is None: 1514s return await cls._create_open_instance(store, path) 1514s 1514s if mode not in ANY_ACCESS_MODE: 1514s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1514s 1514s if store.read_only: 1514s # Don't allow write operations on a read-only store 1514s if mode != "r": 1514s raise ValueError( 1514s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1514s ) 1514s self = await cls._create_open_instance(store, path) 1514s elif mode == "r": 1514s # Create read-only copy for read mode on writable store 1514s try: 1514s read_only_store = store.with_read_only(True) 1514s except NotImplementedError as e: 1514s > raise ValueError( 1514s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1514s "Please use a read-only store or a storage class that implements .with_read_only()." 1514s ) from e 1514s 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(). 1514s 1514s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1514s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=3] ___________ 1514s 1514s cls = 1514s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1514s path = '', mode = 'r' 1514s 1514s @classmethod 1514s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1514s """ 1514s Open StorePath based on the provided mode. 1514s 1514s * If the mode is None, return an opened version of the store with no changes. 1514s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1514s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1514s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1514s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1514s 1514s Parameters 1514s ---------- 1514s mode : AccessModeLiteral 1514s The mode to use when initializing the store path. 1514s 1514s The accepted values are: 1514s 1514s - ``'r'``: read only (must exist) 1514s - ``'r+'``: read/write (must exist) 1514s - ``'a'``: read/write (create if doesn't exist) 1514s - ``'w'``: read/write (overwrite if exists) 1514s - ``'w-'``: read/write (create if doesn't exist). 1514s 1514s Raises 1514s ------ 1514s FileExistsError 1514s If the mode is 'w-' and the store path already exists. 1514s ValueError 1514s If the mode is not "r" and the store is read-only, or 1514s """ 1514s 1514s # fastpath if mode is None 1514s if mode is None: 1514s return await cls._create_open_instance(store, path) 1514s 1514s if mode not in ANY_ACCESS_MODE: 1514s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1514s 1514s if store.read_only: 1514s # Don't allow write operations on a read-only store 1514s if mode != "r": 1514s raise ValueError( 1514s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1514s ) 1514s self = await cls._create_open_instance(store, path) 1514s elif mode == "r": 1514s # Create read-only copy for read mode on writable store 1514s try: 1514s > read_only_store = store.with_read_only(True) 1514s 1514s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1514s read_only = True 1514s 1514s def with_read_only(self, read_only: bool = False) -> Store: 1514s """ 1514s Return a new store with a new read_only setting. 1514s 1514s The new store points to the same location with the specified new read_only state. 1514s The returned Store is not automatically opened, and this store is 1514s not automatically closed. 1514s 1514s Parameters 1514s ---------- 1514s read_only 1514s If True, the store will be created in read-only mode. Defaults to False. 1514s 1514s Returns 1514s ------- 1514s A new store of the same type with the new read only attribute. 1514s """ 1514s > raise NotImplementedError( 1514s f"with_read_only is not implemented for the {type(self)} store type." 1514s ) 1514s E NotImplementedError: with_read_only is not implemented for the store type. 1514s 1514s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1514s 1514s The above exception was the direct cause of the following exception: 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s zarr_format = 3 1514s 1514s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1514s from zarr.storage import ZipStore 1514s 1514s filepath = str(tmpdir / "test.zarr.zip") 1514s original_dt = simple_datatree 1514s store = ZipStore(filepath, mode="w") 1514s original_dt.to_zarr(store, zarr_format=zarr_format) 1514s 1514s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1514s stores = ZarrStore.open_store( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1514s ) = _get_open_params( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1514s zarr_root_group = zarr.open_group(store, **open_kwargs) 1514s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1514s sync( 1514s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1514s raise return_result 1514s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1514s return await coro 1514s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1514s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1514s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1514s return await StorePath.open(store, path=path_normalized, mode=mode) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s cls = 1514s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1514s path = '', mode = 'r' 1514s 1514s @classmethod 1514s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1514s """ 1514s Open StorePath based on the provided mode. 1514s 1514s * If the mode is None, return an opened version of the store with no changes. 1514s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1514s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1514s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1514s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1514s 1514s Parameters 1514s ---------- 1514s mode : AccessModeLiteral 1514s The mode to use when initializing the store path. 1514s 1514s The accepted values are: 1514s 1514s - ``'r'``: read only (must exist) 1514s - ``'r+'``: read/write (must exist) 1514s - ``'a'``: read/write (create if doesn't exist) 1514s - ``'w'``: read/write (overwrite if exists) 1514s - ``'w-'``: read/write (create if doesn't exist). 1514s 1514s Raises 1514s ------ 1514s FileExistsError 1514s If the mode is 'w-' and the store path already exists. 1514s ValueError 1514s If the mode is not "r" and the store is read-only, or 1514s """ 1514s 1514s # fastpath if mode is None 1514s if mode is None: 1514s return await cls._create_open_instance(store, path) 1514s 1514s if mode not in ANY_ACCESS_MODE: 1514s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1514s 1514s if store.read_only: 1514s # Don't allow write operations on a read-only store 1514s if mode != "r": 1514s raise ValueError( 1514s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1514s ) 1514s self = await cls._create_open_instance(store, path) 1514s elif mode == "r": 1514s # Create read-only copy for read mode on writable store 1514s try: 1514s read_only_store = store.with_read_only(True) 1514s except NotImplementedError as e: 1514s > raise ValueError( 1514s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1514s "Please use a read-only store or a storage class that implements .with_read_only()." 1514s ) from e 1514s 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(). 1514s 1514s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1514s _______ TestZarrDatatreeIO.test_to_zarr_not_consolidated[zarr_format=3] ________ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_not_consolidated_1') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s zarr_format = 3 1514s 1514s def test_to_zarr_not_consolidated(self, tmpdir, simple_datatree, zarr_format): 1514s filepath = tmpdir / "test.zarr" 1514s zmetadata = filepath / ".zmetadata" 1514s s1zmetadata = filepath / "set1" / ".zmetadata" 1514s filepath = str(filepath) # casting to str avoids a pathlib bug in xarray 1514s original_dt = simple_datatree 1514s original_dt.to_zarr(filepath, consolidated=False, zarr_format=zarr_format) 1514s assert not zmetadata.exists() 1514s assert not s1zmetadata.exists() 1514s 1514s with pytest.warns(RuntimeWarning, match="consolidated"): 1514s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:514: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ________ TestZarrDatatreeIO.test_open_groups_round_trip[zarr_format=3] _________ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_groups_round_trip_za1') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s zarr_format = 3 1514s 1514s def test_open_groups_round_trip(self, tmpdir, simple_datatree, zarr_format) -> None: 1514s """Test `open_groups` opens a zarr store with the `simple_datatree` structure.""" 1514s filepath = str(tmpdir / "test.zarr") 1514s original_dt = simple_datatree 1514s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1514s 1514s > roundtrip_dict = open_groups(filepath, engine="zarr") 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:631: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1514s backend_groups = backend.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _____________ TestZarrDatatreeIO.test_open_datatree[zarr_format=3] _____________ 1514s 1514s self = 1514s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0x3ff75021c60> 1514s zarr_format = 3 1514s 1514s @pytest.mark.filterwarnings( 1514s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1514s ) 1514s def test_open_datatree(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1514s """Test if `open_datatree` fails to open a zarr store with an unaligned group hierarchy.""" 1514s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1514s 1514s with pytest.raises( 1514s ValueError, 1514s match=( 1514s re.escape("group '/Group2' is not aligned with its parents:") + ".*" 1514s ), 1514s ): 1514s > open_datatree(storepath, engine="zarr") 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:653: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s _________ TestZarrDatatreeIO.test_open_datatree_chunks[zarr_format=3] __________ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_chunks_zarr1') 1514s zarr_format = 3 1514s 1514s @requires_dask 1514s def test_open_datatree_chunks(self, tmpdir, zarr_format) -> None: 1514s filepath = str(tmpdir / "test.zarr") 1514s 1514s chunks = {"x": 2, "y": 1} 1514s 1514s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1514s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1514s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1514s original_tree = DataTree.from_dict( 1514s { 1514s "/": root_data.chunk(chunks), 1514s "/group1": set1_data.chunk(chunks), 1514s "/group2": set2_data.chunk(chunks), 1514s } 1514s ) 1514s original_tree.to_zarr(filepath, zarr_format=zarr_format) 1514s 1514s > with open_datatree(filepath, engine="zarr", chunks=chunks) as tree: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:673: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ______________ TestZarrDatatreeIO.test_open_groups[zarr_format=3] ______________ 1514s 1514s self = 1514s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0x3ff75021c60> 1514s zarr_format = 3 1514s 1514s @pytest.mark.filterwarnings( 1514s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1514s ) 1514s def test_open_groups(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1514s """Test `open_groups` with a zarr store of an unaligned group hierarchy.""" 1514s 1514s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1514s > unaligned_dict_of_datasets = open_groups(storepath, engine="zarr") 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:689: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1514s backend_groups = backend.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[True-zarr_format=3] ___ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr2') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s write_consolidated_metadata = True, zarr_format = 3 1514s 1514s @pytest.mark.filterwarnings( 1514s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1514s ) 1514s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1514s def test_open_datatree_specific_group( 1514s self, 1514s tmpdir, 1514s simple_datatree, 1514s write_consolidated_metadata, 1514s zarr_format, 1514s ) -> None: 1514s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1514s filepath = str(tmpdir / "test.zarr") 1514s group = "/set2" 1514s original_dt = simple_datatree 1514s original_dt.to_zarr( 1514s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1514s ) 1514s expected_subtree = original_dt[group].copy() 1514s expected_subtree.orphan() 1514s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s __ TestZarrDatatreeIO.test_open_datatree_specific_group[False-zarr_format=3] ___ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr4') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s write_consolidated_metadata = False, zarr_format = 3 1514s 1514s @pytest.mark.filterwarnings( 1514s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1514s ) 1514s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1514s def test_open_datatree_specific_group( 1514s self, 1514s tmpdir, 1514s simple_datatree, 1514s write_consolidated_metadata, 1514s zarr_format, 1514s ) -> None: 1514s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1514s filepath = str(tmpdir / "test.zarr") 1514s group = "/set2" 1514s original_dt = simple_datatree 1514s original_dt.to_zarr( 1514s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1514s ) 1514s expected_subtree = original_dt[group].copy() 1514s expected_subtree.orphan() 1514s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[None-zarr_format=3] ___ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr6') 1514s simple_datatree = 1514s Group: / 1514s │ Dimensions: (y: 3, x: 2) 1514s │ Dimensions without coordinates: y, x 1514s │ Data variables: 1514s ... a (x) int64 16B 2 3 1514s │ │ b (x) float64 16B 0.1 0.2 1514s │ └── Group: /set2/set1 1514s └── Group: /set3 1514s write_consolidated_metadata = None, zarr_format = 3 1514s 1514s @pytest.mark.filterwarnings( 1514s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1514s ) 1514s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1514s def test_open_datatree_specific_group( 1514s self, 1514s tmpdir, 1514s simple_datatree, 1514s write_consolidated_metadata, 1514s zarr_format, 1514s ) -> None: 1514s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1514s filepath = str(tmpdir / "test.zarr") 1514s group = "/set2" 1514s original_dt = simple_datatree 1514s original_dt.to_zarr( 1514s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1514s ) 1514s expected_subtree = original_dt[group].copy() 1514s expected_subtree.orphan() 1514s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1514s backend_tree = backend.open_datatree( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1514s groups_dict = self.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s __________ TestZarrDatatreeIO.test_open_groups_chunks[zarr_format=3] ___________ 1514s 1514s self = 1514s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_groups_chunks_zarr_f1') 1514s zarr_format = 3 1514s 1514s @requires_dask 1514s def test_open_groups_chunks(self, tmpdir, zarr_format) -> None: 1514s """Test `open_groups` with chunks on a zarr store.""" 1514s 1514s chunks = {"x": 2, "y": 1} 1514s filepath = str(tmpdir / "test.zarr") 1514s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1514s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1514s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1514s original_tree = DataTree.from_dict( 1514s { 1514s "/": root_data.chunk(chunks), 1514s "/group1": set1_data.chunk(chunks), 1514s "/group2": set2_data.chunk(chunks), 1514s } 1514s ) 1514s original_tree.to_zarr(filepath, mode="w", zarr_format=zarr_format) 1514s 1514s > dict_of_datasets = open_groups(filepath, engine="zarr", chunks=chunks) 1514s 1514s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:752: 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1514s backend_groups = backend.open_groups_as_dict( 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1514s group_ds = store_entrypoint.open_dataset( 1514s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1514s vars, attrs = filename_or_obj.load() 1514s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1514s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1514s return Frozen(dict(*args, **kwargs)) 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1514s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1514s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1514s 1514s self = , name = 'b' 1514s 1514s def open_store_variable(self, name): 1514s zarr_array = self.members[name] 1514s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1514s try_nczarr = self._mode == "r" 1514s dimensions, attributes = _get_zarr_dims_and_attrs( 1514s zarr_array, DIMENSION_KEY, try_nczarr 1514s ) 1514s attributes = dict(attributes) 1514s 1514s encoding = { 1514s "chunks": zarr_array.chunks, 1514s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1514s } 1514s 1514s if _zarr_v3(): 1514s encoding.update( 1514s { 1514s "compressors": zarr_array.compressors, 1514s "filters": zarr_array.filters, 1514s "shards": zarr_array.shards, 1514s } 1514s ) 1514s if self.zarr_group.metadata.zarr_format == 3: 1514s encoding.update({"serializer": zarr_array.serializer}) 1514s else: 1514s encoding.update( 1514s { 1514s "compressor": zarr_array.compressor, 1514s "filters": zarr_array.filters, 1514s } 1514s ) 1514s 1514s if self._use_zarr_fill_value_as_mask: 1514s # Setting this attribute triggers CF decoding for missing values 1514s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1514s if zarr_array.fill_value is not None: 1514s attributes["_FillValue"] = zarr_array.fill_value 1514s elif "_FillValue" in attributes: 1514s original_zarr_dtype = zarr_array.metadata.data_type 1514s attributes["_FillValue"] = FillValueCoder.decode( 1514s > attributes["_FillValue"], original_zarr_dtype.value 1514s ) 1514s E AttributeError: 'Float64' object has no attribute 'value' 1514s 1514s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1514s =============================== warnings summary =============================== 1514s tests/test_backends.py: 4 warnings 1514s tests/test_conventions.py: 1 warning 1514s tests/test_rolling.py: 36 warnings 1514s /usr/lib/python3/dist-packages/xarray/core/duck_array_ops.py:237: RuntimeWarning: invalid value encountered in cast 1514s return data.astype(dtype, **kwargs) 1514s 1514s tests/test_backends.py: 540 warnings 1514s tests/test_backends_datatree.py: 15 warnings 1514s /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. 1514s warnings.warn( 1514s 1514s tests/test_backends.py: 111 warnings 1514s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=1, endianness='big')) 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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1514s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1514s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1514s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1514s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1514s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=6, endianness='big')) 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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py: 99 warnings 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1514s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1514s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py: 12 warnings 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 1514s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 1514s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 1514s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=4, endianness='big')) 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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 1514s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 1514s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py: 33 warnings 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py: 30 warnings 1514s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=2, endianness='big')) 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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends.py: 27 warnings 1514s /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. 1514s v3_unstable_dtype_warning(self) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1514s /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. 1514s super().__init__(**codec_config) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1514s /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. 1514s super().__init__(**codec_config) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: '.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: '.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/.zarray' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/.zarray' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/.zarray' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/.zarray' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/.zarray' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/.zarray' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/.zgroup' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/.zattrs' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/zarr.json' 1514s return self._open_to_write(zinfo, force_zip64=force_zip64) 1514s 1514s tests/test_dask.py: 12 warnings 1514s tests/test_units.py: 10 warnings 1514s /usr/lib/python3/dist-packages/numpy/_core/numeric.py:476: RuntimeWarning: invalid value encountered in cast 1514s multiarray.copyto(res, fill_value, casting='unsafe') 1514s 1514s tests/test_duck_array_ops.py: 16 warnings 1514s /usr/lib/python3/dist-packages/dask/array/core.py:5083: RuntimeWarning: overflow encountered in scalar add 1514s result = function(*args, **kwargs) 1514s 1514s tests/test_duck_array_ops.py::test_cftime_datetime_mean[True] 1514s /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. 1514s result = function(*args, **kwargs) 1514s 1514s tests/test_duck_array_wrapping.py::TestDataArrayMethods::test_astype[pint] 1514s /usr/lib/python3/dist-packages/pint/facets/numpy/quantity.py:88: RuntimeWarning: invalid value encountered in cast 1514s value = func(*args, **kwargs) 1514s 1514s tests/test_strategies.py::TestReduction::test_mean 1514s tests/test_strategies.py::TestReduction::test_mean 1514s tests/test_strategies.py::TestReduction::test_mean 1514s tests/test_strategies.py::TestReduction::test_mean 1514s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:86: RuntimeWarning: overflow encountered in reduce 1514s return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 1514s 1514s tests/test_strategies.py::TestReduction::test_mean 1514s tests/test_strategies.py::TestReduction::test_mean 1514s tests/test_strategies.py::TestReduction::test_mean 1514s tests/test_strategies.py::TestReduction::test_mean 1514s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce 1514s return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 1514s 1514s tests/test_tutorial.py::TestLoadDataset::test_download_from_github 1514s /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='a6ae8243-8ee5-4a62-99a3-96ecf7b44a3b'), but file is not already closed. This may indicate a bug. 1514s result = testfunction(**testargs) 1514s 1514s tests/test_tutorial.py::TestLoadDataset::test_download_from_github_load_without_cache 1514s /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='98d7a13f-a566-4ae5-939c-3784e3610be5'), but file is not already closed. This may indicate a bug. 1514s result = testfunction(**testargs) 1514s 1514s tests/test_tutorial.py::TestLoadDataset::test_download_from_github_load_without_cache 1514s /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='f98524f7-1fdd-4460-ad7e-df176dab1b91'), but file is not already closed. This may indicate a bug. 1514s result = testfunction(**testargs) 1514s 1514s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-compatible_unit-function_clip] 1514s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-identical_unit-function_clip] 1514s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-compatible_unit-function_clip] 1514s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-identical_unit-function_clip] 1514s /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) 1514s return conv.wrap(result, to_scalar=False) 1514s 1514s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_ffill] 1514s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_bfill] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2766: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py: 15 warnings 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2803: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataArray::test_dropna[int64] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2831: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 1514s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 1514s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 1514s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 1514s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2856: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 1514s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 1514s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 1514s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 1514s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2861: RuntimeWarning: invalid value encountered in cast 1514s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 1514s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4252: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 1514s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4256: RuntimeWarning: invalid value encountered in cast 1514s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1514s 1514s tests/test_units.py: 15 warnings 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4295: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py: 15 warnings 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4299: RuntimeWarning: invalid value encountered in cast 1514s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_dropna[int64] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4325: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_dropna[int64] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4329: RuntimeWarning: invalid value encountered in cast 1514s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1514s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4353: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1514s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4357: RuntimeWarning: invalid value encountered in cast 1514s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1514s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1514s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4362: RuntimeWarning: invalid value encountered in cast 1514s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_interpolate_na[int64] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4438: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_interpolate_na[int64] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4442: RuntimeWarning: invalid value encountered in cast 1514s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1514s 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4487: RuntimeWarning: invalid value encountered in cast 1514s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) * data_unit 1514s 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 1514s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 1514s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4490: RuntimeWarning: invalid value encountered in cast 1514s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) * data_unit 1514s 1514s tests/test_variable.py::TestIndexVariable::test_to_index_multiindex_level 1514s /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)`. 1514s ds = Dataset(coords={"x": midx}) 1514s 1514s tests/test_weighted.py::test_weighted_quantile_3D[None-True-q1-a] 1514s tests/test_weighted.py::test_weighted_quantile_3D[True-True-0.5-a] 1514s /usr/lib/python3/dist-packages/numpy/lib/_nanfunctions_impl.py:1617: RuntimeWarning: All-NaN slice encountered 1514s return fnb._ureduce(a, 1514s 1514s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 1514s =========================== short test summary info ============================ 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_store[3] - Attri... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_load[3] - AttributeErr... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - A... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - At... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_dropna[3] - AttributeE... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_bytes_with_fill_value[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - At... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_overwrite_values[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - Attrib... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - Attr... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - At... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - At... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_group[3] - AttributeEr... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_write[3] - Attr... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_not_set_raises[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - A... 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1514s FAILED tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_store[3] - ... 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_test_data[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_load[3] - Attribu... 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dataset_compute[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_object_dtype[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_float64_data[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_orthogonal_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing_negative_step[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_outer_indexing_reversed[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_isel_dataarray[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_array_type_after_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dropna[3] - Attri... 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_ondisk_after_print[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_bytes_with_fill_value[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value0-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value1-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3--1-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-255-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_coordinate_variables_after_dataset_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_kwarg[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_default_fill_value[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_same_dtype[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_overwrite_values[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_read_non_consolidated_warning[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_auto_chunk[3] - A... 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_manual_chunk[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_warning_on_bad_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_uneven_dask_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_shard_encoding[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-group1] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_compressor_encoding[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_group[3] - Attrib... 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_write[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_not_set_raises[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-U] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-S] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_check_encoding_is_consistent_after_append[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_new_variable[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_no_overwrite[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_compute_false_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_append_compute_false_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_no_warning_from_open_emptydim_with_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-None] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-r+] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-a] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_preexisting_override_metadata[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_chunksizes[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding_with_partial_dask_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_open_zarr_use_cftime[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_read_select_write[3] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_attributes[3-obj1] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1514s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zarr_fill_value_setting[3-float] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_store[3] - Attr... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_test_data[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_load[3] - AttributeEr... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dataset_compute[3] - ... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_object_dtype[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_float64_data[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_orthogonal_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing_negative_step[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_outer_indexing_reversed[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_isel_dataarray[3] - A... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_array_type_after_indexing[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dropna[3] - Attribute... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_ondisk_after_print[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_bytes_with_fill_value[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value0-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value1-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3--1-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-255-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_coordinate_variables_after_dataset_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_kwarg[3] - A... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_default_fill_value[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_same_dtype[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_overwrite_values[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_read_non_consolidated_warning[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_auto_chunk[3] - Attri... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_manual_chunk[3] - Att... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_warning_on_bad_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_uneven_dask_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding[3] - A... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_shard_encoding[3] - A... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-group1] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_compressor_encoding[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_group[3] - AttributeE... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_write[3] - Att... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_not_set_raises[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-U] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-S] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_check_encoding_is_consistent_after_append[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_new_variable[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_no_overwrite[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_compute_false_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_append_compute_false_roundtrip[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_no_warning_from_open_emptydim_with_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-r+] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-a] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_preexisting_override_metadata[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_chunksizes[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding_with_partial_dask_chunks[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_open_zarr_use_cftime[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_read_select_write[3] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_attributes[3-obj1] - ... 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zarr_fill_value_setting[3-float] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-None] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-True] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-False] 1514s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-None] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-full-auto] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-mixed-auto] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_index_write[3] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region[3] - Attr... 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_append_chunk_partial[3] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_chunk_partial_offset[3] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_append_dim[3] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-r+] 1514s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-a] 1514s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[auto] - Attrib... 1514s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[-1] - Attribut... 1514s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks2] - Att... 1514s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks3] - Att... 1514s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks4] - Att... 1514s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks5] - Att... 1514s FAILED tests/test_backends.py::test_chunking_consintency[auto] - AttributeErr... 1514s FAILED tests/test_backends.py::test_chunking_consintency[-1] - AttributeError... 1514s FAILED tests/test_backends.py::test_chunking_consintency[chunks2] - Attribute... 1514s FAILED tests/test_backends.py::test_chunking_consintency[chunks3] - Attribute... 1514s FAILED tests/test_backends.py::test_chunking_consintency[chunks4] - Attribute... 1514s FAILED tests/test_backends.py::test_chunking_consintency[chunks5] - Attribute... 1514s FAILED tests/test_backends.py::TestNCZarr::test_overwriting_nczarr - Attribut... 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_not_consolidated[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_round_trip[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_chunks[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups[zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[True-zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[False-zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[None-zarr_format=3] 1514s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_chunks[zarr_format=3] 1514s = 362 failed, 19245 passed, 1887 skipped, 51 deselected, 243 xfailed, 104 xpassed, 1113 warnings in 645.64s (0:10:45) = 1518s E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /tmp/autopkgtest.AKjRcB/autopkgtest_tmp/build; python3.13 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 1518s pybuild-autopkgtest: error: pybuild --autopkgtest --test-pytest -i python{version} -p "3.14 3.13" returned exit code 13 1518s make: *** [/tmp/C0d2L_khqE/run:4: pybuild-autopkgtest] Error 25 1518s pybuild-autopkgtest: error: /tmp/C0d2L_khqE/run pybuild-autopkgtest returned exit code 2 1519s autopkgtest [11:23:29]: test pybuild-autopkgtest: -----------------------] 1521s pybuild-autopkgtest FAIL non-zero exit status 25 1521s autopkgtest [11:23:31]: test pybuild-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 1522s autopkgtest [11:23:32]: @@@@@@@@@@@@@@@@@@@@ summary 1522s pybuild-autopkgtest FAIL non-zero exit status 25