asdf icon indicating copy to clipboard operation
asdf copied to clipboard

Only write base array of a view when explicitly requested

Open lgarrison opened this issue 4 years ago • 1 comments

From #989, the current ASDF behavior of writing the underlying base array of a Numpy view can lead to unexpected results, like a file being much bigger than anticipated when the view is a small portion of the base array. Of course, this behavior can lead to space savings when multiple views of the base array are in the ASDF file. But rather than try to infer whether to enable this behavior based on expected space savings, the simpler behavior is to make this opt-in, probably via an arg to write_to or the ASDF config.

lgarrison avatar Jun 09 '21 20:06 lgarrison

Agree. It would be nice to not try to infer intentions, but make intentions explicit in a kwarg.

So is the suggestion to then make a copy before writing out, and only keep the base/view if explicitly asked? That seems sane to me.

jdavies-st avatar Jun 10 '21 13:06 jdavies-st