Open braingram opened 1 year ago
Currently the Quantity converter calls _make_array before creating the Quantity: https://github.com/astropy/asdf-astropy/blob/0c502517a5cca9a6ce03150ad0c6472ae12a2e1f/asdf_astropy/converters/unit/quantity.py#L33
_make_array
When the array is stored as an internal ASDF block this will force the block to be loaded at the time of deserialization.
Initial attempts to enable lazy loading by removing the above mentioned line do not prevent the ASDF block from being loaded possibly because NDArrayType is not a subclass of ndarray and astropy will attempt to iterate through the array during loading: https://github.com/astropy/astropy/blob/79dd50f61ef5e0a568dd42549319db38fefd0bc7/astropy/units/quantity.py#L495 triggering loading of the ASDF block.
Whenever Quantity is updated to support the Python array API standard, then this will become trivial because Quantity will no longer subclass ndarray, instead it will satisfy the API's protocol.
Quantity
ndarray
Currently the Quantity converter calls
_make_array
before creating the Quantity: https://github.com/astropy/asdf-astropy/blob/0c502517a5cca9a6ce03150ad0c6472ae12a2e1f/asdf_astropy/converters/unit/quantity.py#L33When the array is stored as an internal ASDF block this will force the block to be loaded at the time of deserialization.
Initial attempts to enable lazy loading by removing the above mentioned line do not prevent the ASDF block from being loaded possibly because NDArrayType is not a subclass of ndarray and astropy will attempt to iterate through the array during loading: https://github.com/astropy/astropy/blob/79dd50f61ef5e0a568dd42549319db38fefd0bc7/astropy/units/quantity.py#L495 triggering loading of the ASDF block.