-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Is your feature request related to a problem? Please describe.
Upon updating to v4, all old cached boxes from users will not be able to be read any more. Ostensibly as the code changes into the future, this will happen again to v4 boxes.
Describe the solution you'd like
This has been partially addressed by:
- Making it possible to have different
readfunctions inh5.pyas of v4, that automatically detect the version of 21cmFAST with which the box was written, and use the appropriate read function. This should help into the future. - Ignoring unused arrays that might be in the HDF5 structure.
However, these still don't address the problem of pre-v4 boxes sitting on disk already (since these didn't store the 21cmFAST version in their header, and so it is impossible to know which function to read them with).
What we could do, if we deem it useful enough, is to write something like a compatibility.py module that is able to translate between renamed parameters in different versions, and/or specify boxes that ought to be ignored, or default values for boxes that didn't previously exist (and the same for input parameters).
It's probably better to encapsulate this in a standalone module rather than trying to include all the logic in e.g. h5.py read functions, because we don't want to mix up the compatibility logic with the logic that's directly needed for reading hdf5 formats (and anyway, it's possible that in the future we support different formats).
Describe alternatives you've considered
- The leading alternative would be to just ignore old boxes, treating them as "not important enough" to be able to read with the new version. The cost-to-benefit here is probably dictated mostly by how many boxes we think users do really have on disk that they want to keep using.
- Another alternative would be to simply provide a schema for the layout of v3 boxes so that users can just use h5py directly to read in their old boxes (and not be able to use them in v4 runs at all, but still be able to load the 3D boxes to plot etc.)