The package currently does not support saving or loading regions. This would be an extremely useful feature to support because regions in high-resolution models can take a fairly long time to compute but once they are computed are cheap to reuse.
I have had some success using pickle to locally save and load class instances but there are two fatal flaws to this approach:
- the files written by
pickle are not safe as unknown Python code may be executing while reading in a file
- without a stable file structure, it is not guaranteed that files written with one version of
regionate will be readable by an earlier or later version.
My proposal is to create custom save and load methods that store class attributes using more robust save methods from established packages (e.g. xarray, pandas, json). I have not yet figures out how best to do this, especially when dealing with class inheritance of these methods.
The package currently does not support saving or loading regions. This would be an extremely useful feature to support because regions in high-resolution models can take a fairly long time to compute but once they are computed are cheap to reuse.
I have had some success using
pickleto locally save and load class instances but there are two fatal flaws to this approach:pickleare not safe as unknown Python code may be executing while reading in a fileregionatewill be readable by an earlier or later version.My proposal is to create custom
saveandloadmethods that store class attributes using more robust save methods from established packages (e.g.xarray,pandas,json). I have not yet figures out how best to do this, especially when dealing with class inheritance of these methods.