question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FutureWarning from zarr.open

See original GitHub issue

The following code snippet will raise a FutureWarning:

import numpy
import zarr                                                                                                                                                                                                                                                                                                                                                        
group = zarr.open()                                                                                                                                                                                                                                                                                                                                                
group.create('foo', dtype=[('a', int), ('b', int)], fill_value=numpy.zeros((), dtype=[('a', int), ('b', int)])[()], shape=(10, 10))                                                                                                                                                                                                                                

Problem description

The current behavior raises a FutureWarning:

zarr/util.py:238: FutureWarning: elementwise == comparison failed and returning scalar instead; this will raise an error or perform elementwise comparison in the future.
  elif fill_value == 0:

This happens because of the comparison of the utterable dtype to 0 (in line 258) above. I’m not sure if this error is a false positive from numpy or something that will actually break in a future numpy version.

Version and installation information

Please provide the following:

  • Value of zarr.__version__: ‘2.3.2’
  • Value of numcodecs.__version__: ‘0.6.4’
  • Version of Python interpreter: 3.7.6
  • Operating system (Linux/Windows/Mac): Mac and Linux
  • How Zarr was installed: using conda (also from source)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
joshmoorecommented, Oct 26, 2021

Doh. Sorry, @maiia-pi, I somehow lost a comment I had prepared. More briefly, it looks like @d-v-b ran into this issue here:

https://github.com/zarr-developers/zarr-python/pull/738/files#diff-f389c1f0162cd60b1b5a4187dad20dfd3d22c98da2ebe22e860ea830bc25a0e9R692

You might try to use his zarr.util.all_equal method and see if it will fix it, but I assume that this is a bigger problem if we didn’t have a suggestion.

0reactions
maiia-picommented, Oct 23, 2021

Tried this code snippet above to check if the issue remains

import numpy
import zarr                                                                                                                                                                                                                                                                                                                                                        
group = zarr.open()                                                                                                                                                                                                                                                                                                                                                
group.create('foo', dtype=[('a', int), ('b', int)], fill_value=numpy.zeros((), dtype=[('a', int), ('b', int)])[()], shape=(10, 10))     

Future Warning still rises.

zarr\util.py:259: FutureWarning: elementwise == comparison failed and returning scalar instead; this will raise an error or perform elementwise comparison in the future.
  elif fill_value == 0:             
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial — zarr 2.13.3 documentation - Read the Docs
The zarr.convenience.open() function provides a convenient way to create a new persistent array or continue working with an existing array.
Read more >
Python zarr.open() Examples - ProgramCreek.com
This page shows Python examples of zarr.open. ... The following are 30 code examples of zarr.open(). ... FutureWarning, ) return pd.
Read more >
What's New - Xarray
This release brings the ability to write to limited regions of zarr files, open zarr files with open_dataset() and open_mfdataset() , increased support...
Read more >
Source code for dask.array.core
category=FutureWarning, ) name = token name = f"{name or ... Parameters ---------- arr: dask.array Data to store url: Zarr Array or str or...
Read more >
Test ZARR performance for CAB-LAB data cubes
import xarray as xr import zarr from esdl import Cube. In [31]: ... ~60 GB cube = Cube.open('C:\\Users\\Norman\\EOData\\cablab-datacube-1.0.0\\low-res').
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found