asdf-format / asdf

ASDF (Advanced Scientific Data Format) is a next generation interchange format for scientific data

Home Page:http://asdf.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

masked arrays do not roundtrip with all false masks

braingram opened this issue · comments

Description of the problem

Attempting to save a masked array with an all false mask results in no errors. Yet when loaded the array is no longer masked.

See:

if isinstance(data, ma.MaskedArray) and np.any(data.mask):
if options.storage_type == "inline":
ctx._blocks._set_array_storage(data.mask, "inline")
result["mask"] = data.mask

I believe that removing np.any(data.mask) would fix the issue.

Example of the problem

System information

asdf version: main
python version: python 3.10
operating system: mac