asdf-format/asdf

masked arrays do not roundtrip with all false masks

Closed this issue · 0 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