SciTools / iris

A powerful, format-agnostic, and community-driven Python package for analysing and visualising Earth science data
https://scitools-iris.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
635 stars 284 forks source link

`iris.util.array_equal` ignores differences in masks with dask arrays #6188

Open bouweandela opened 1 month ago

bouweandela commented 1 month ago

🐛 Bug Report

How To Reproduce

Steps to reproduce the behaviour:

In [1]: import dask.array as da
   ...: from iris.util import array_equal

In [2]: array_equal(da.array([1, 2]), da.ma.masked_array([1, 3], mask=[0, 1]))
Out[2]: True

Expected behaviour

The return value should be False because the arrays have different masks.

For numpy arrays, this work fine:

In [1]: import numpy as np
   ...: from iris.util import array_equal

In [2]: array_equal(np.array([1, 2]), np.ma.masked_array([1, 3], mask=[0, 1]))
Out[2]: False

so I would expect the same for dask arrays.

Screenshots

Environment

trexfeathers commented 1 month ago

I'm only skim reading but is the discussion on #4457 useful at all?

bouweandela commented 1 month ago

Unfortunately not, the issue is also present in the current main branch